[Patch] New Makefile

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 11:42 am

Can you just test something like

address.sin_addr = inet_addr(ip);

Instead of

inet_pton(AF_INET, ip, &address.sin_addr);
Ian
 
Posts: 1517
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 11:57 am

The function seems recognized, however during compilation it throws out this:

Code: Select all
Src/Network/UDPSend.cpp: In member function 'bool SMUDP::UDPSend::Send(const char*, int, int, const void*, int)':
Src/Network/UDPSend.cpp:83:33: error: no match for 'operator=' (operand types are 'in_addr' and 'long unsigned int')
  address.sin_addr = inet_addr(ip);
                                 ^
In file included from D:/.dev/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:54:0,
                 from Src/Network/UDPSend.cpp:1:
D:/.dev/msys64/mingw64/x86_64-w64-mingw32/include/inaddr.h:17:16: note: candidate: constexpr in_addr& in_addr::operator=(const in_addr&)
 typedef struct in_addr {
                ^~~~~~~
D:/.dev/msys64/mingw64/x86_64-w64-mingw32/include/inaddr.h:17:16: note:   no known conversion for argument 1 from 'long unsigned int' to 'const in_addr&'
D:/.dev/msys64/mingw64/x86_64-w64-mingw32/include/inaddr.h:17:16: note: candidate: constexpr in_addr& in_addr::operator=(in_addr&&)
D:/.dev/msys64/mingw64/x86_64-w64-mingw32/include/inaddr.h:17:16: note:   no known conversion for argument 1 from 'long unsigned int' to 'in_addr&&'
make: *** [Makefiles/Makefile.inc:324: _obj/UDPSend.o] Error 1
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 12:11 pm

think the code should be something like

address.sin_addr.S_un.S_addr = inet_addr(ip);

But it doesn't compile with visual studio :(
Error 1 error C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings udpsend.cpp

I guess we could put an #ifdef in there if it works with your compiler
Ian
 
Posts: 1517
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 12:18 pm

Ian wrote:But it doesn't compile with visual studio :(
Error 1 error C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings udpsend.cpp

Yeah, I was just reading something about that right now, also inet_addr is deprecated because it doesn't support IPv6.

Ian wrote:I guess we could put an #ifdef in there if it works with your compiler

This is actually what I've done in my patch:
Code: Select all
#ifdef __GNUC__
// Code compatible with GNU toolchain
#endif

I've included also two solutions: the first is to replace that function with an equivalent one, the second is an external C linkage. Both works, just tried the other day.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 1:27 pm

I renamed IO.h in my visual studio project, and then clicked on the .cpp file where it included it. And went open, expecting it not to be there, and instead took me to some file io file. So yeah I can see the possibility of some conflict there :)
Ian
 
Posts: 1517
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 1:59 pm

Ian wrote:So yeah I can see the possibility of some conflict there

this is a snippet of that system <io.h> file:

Code: Select all
**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */
#ifndef _IO_H_
#define _IO_H_

#include <crtdefs.h>
#include <string.h>

#if defined(__LIBMSVCRT__)
/* When building mingw-w64, this should be blank.  */
#define _SECIMP
#else
#ifndef _SECIMP
#define _SECIMP __declspec(dllimport)
#endif /* _SECIMP */
#endif /* defined(_CRTBLD) || defined(__LIBMSVCRT__) */

#pragma pack(push,_CRT_PACKING)

#ifdef __cplusplus
extern "C" {
#endif

_CRTIMP char* __cdecl _getcwd (char*, int);
#ifndef _FSIZE_T_DEFINED
  typedef unsigned long _fsize_t;
#define _FSIZE_T_DEFINED
#endif

I guess has something to do with an implementation of MS runtimes?
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 2:02 pm

Ian, I don't want to sound annoying but this happens when compiling with r706:

Code: Select all
[...]
Src/Debugger/CPU/Musashi68KDebug.h:57:8: error: extra qualification 'Debugger::CMusashi68KDebug::' on member 'SetM68KContext' [-fpermissive]
   void CMusashi68KDebug::SetM68KContext()
[...]

And it goes on and on for a huge number of times. I fixed it by removing every instance of CMusashi68KDebug:: from the function names.
Last edited by HarryTuttle on Mon Jan 22, 2018 2:06 pm, edited 1 time in total.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 2:04 pm

Let me check quick, it compiles fine here

Maybe I am being dense, what is broken here ? :)
What did you change from what to what?

Edit:
Okay, never mind I see
Ian
 
Posts: 1517
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 2:11 pm

Try the current build, hopefully I didn't break anything else >_<

Also this is what io.h is in visual studio for reference

Code: Select all
/***
*io.h - declarations for low-level file handling and I/O functions
*
*       Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
*       This file contains the function declarations for the low-level
*       file handling and I/O functions.
*
*       [Public]
*
****/

#pragma once

#ifndef _INC_IO
#define _INC_IO

#include <crtdefs.h>

/*
 * Currently, all MS C compilers for Win32 platforms default to 8 byte
 * alignment.
 */
#pragma pack(push,_CRT_PACKING)


#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

#ifndef _FSIZE_T_DEFINED
typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
Ian
 
Posts: 1517
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 2:37 pm

Ian wrote:Try the current build, hopefully I didn't break anything else >_<

I'm happy to report that all went fine! :)
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Previous

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 2 guests