View unanswered posts | View active topics It is currently Wed Oct 23, 2019 4:42 am



Reply to topic  [ 16 posts ] 
Issues with compiling ZSNES (v1.51) these days... :( 
Author Message
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Issues with compiling ZSNES (v1.51) these days... :(
I use MinGW to compile ZSNES myself :) had no issues since 2005 when I first started to compile it myself...
but starting maybe last year or so...

ZSNES compiles but now cashes on load...
Code:
Program received signal SIGSEGV, Segmentation fault.
0x006064b6 in zmain (zargc=0, zargv=0x0) at zloader.c:942
942       if (init_paths(*zargv))

(gdb) bt
#0  0x006064b6 in zmain (zargc=0, zargv=0x0) at zloader.c:942
#1  0x00606531 in WinMain@16 (hInstance=0x400000, hPrevInstance=hPrevInstance@entry=0x0, szCmdLine=szCmdLine@entry=0x12d3480 "",
    iCmdShow=iCmdShow@entry=10) at zloader.c:962
#2  0x00766dcb in main (argc=1, argv=0x15711a0, __p__environ=0x1571740) at ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c:91


btw I am running Windows 7 Ultimate 64bit
and I am using FuSoYa's 8MB fix version of the ZSNES src... had no issues with it till last year for no apparent reason...
http://fusoya.eludevisibility.org/emulator/zsnes8.html

Also I am running MinGW v4.9.3-1 for all gcc and G++ packages.. and
mingw32-make-bin3.82.90-2-cvs-20120902
mingw32-mingwrt-dev=3.21.1
mingw32-mingwrt-dll=3.21.1
mingw32-w32api-dev=3.17-2
etc

with this version I get one warning trying to compile parsegen.exe and that is it...
something about size_t when it wants main to be int..

I tried MinGW v5.3.0-3 but that definitely does not work with ZSNES :(

my system specs are in my signature...

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Mon Mar 13, 2017 6:09 pm
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
I downgraded my MinGW packages to v4.8.1-4 and all others that needed to downgrade as well...

one warning on compiling parsegen.exe

no warnings or errors on the rest of ZSNES v1.51 src...
still no go its still crashing on load

Code:
void zmain(int zargc, char *zargv[])
{
  if (init_paths(*zargv))            // <-- SIGSEGV Crashes here
  {
    #ifdef __LIBAO__
    ao_initialize();
    atexit(ao_shutdown);
    #endif
    handle_params(zargc, zargv);

    atexit(ZCleanup);
    srand(time(0));
    zstart();
  }
}


Code:
GNU gdb (GDB) 7.6.1

Reading symbols from
F:\Dev-src\2Emulators\zsnes_Testing__v1.51_(FuSoYa-8MB_R2)\zsnesw_v1.51_Debug_(+nocona-opt_mmx&sse2)+(2017-03-15).exe...
expanding to full symbols...
done.

(gdb) r
Starting program: F:\Dev-src\2Emulators\zsnes_Testing__v1.51_(FuSoYa-8MB_R2)/zsnesw_v1.51_Debug_(+nocona-opt_mmx&sse2)+(2017-03-15).exe
[New Thread 3580.0x1be4]

Program received signal SIGSEGV, Segmentation fault.
0x006064d8 in zmain (zargc=0, zargv=0x0) at zloader.c:942
942       if (init_paths(*zargv))

(gdb) bt full
#0  0x006064d8 in zmain (zargc=0, zargv=0x0) at zloader.c:942
No locals.

#1  0x00606553 in WinMain@16 (hInstance=0x400000, hPrevInstance=hPrevInstance@entry=0x0, szCmdLine=szCmdLine@entry=0x1673480 "",
    iCmdShow=iCmdShow@entry=10) at zloader.c:962
No locals.

#2  0x0075bd8b in main (argc=1, argv=0x3b11a0, __p__environ=0x3b1740) at ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c:91
        szCmd = 0x1673480 ""
        startinfo = {cb = 68, lpReserved = 0x1679140 "", lpDesktop = 0x1679160 "Winsta0\\Default",
          lpTitle = 0x1679f70 "F:\\Dev-src\\2Emulators\\zsnes_Testing__v1.51_(FuSoYa-8MB_R2)\\zsnesw_v1.51_Debug_(+nocona-opt_mmx&sse2)+(2017-03-15).exe", dwX = 0, dwY = 0, dwXSize = 0, dwYSize = 0, dwXCountChars = 0, dwYCountChars = 0, dwFillAttribute = 0, dwFlags = 0,
          wShowWindow = 0, cbReserved2 = 0, lpReserved2 = 0x0, hStdInput = 0xffffffff, hStdOutput = 0xffffffff, hStdError = 0xffffffff}
        nRet = <optimized out>


I use the following compiler settings:
make -f makefile.ms PLATFORM=win32 RELEASEGRADE=no DEBUG=yes CPU=nocona

in the makefile I customized it a bit, back 2015..
I set the opts to -mmmx and -msse2 which seems to work well...

I have not changed anything in the zsnes src.
It worked before so I know that's not what is wrong...

has to be MinGW but I went back to a version that was sure to work....


old working copy: 11.2 MB (11,832,117 bytes)
crashing copy : 11.6 MB (12,267,477 bytes)

If anyone wants to try them out let me know and I will upload both copies to my Dropbox account...

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Thu Mar 16, 2017 4:21 am
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Have you even verified that whatever is calling zmain is passing in a valid zargv? Dereferencing a null pointer will always cause a crash.


Thu Mar 16, 2017 11:47 pm
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Hi Kode54 ^_^ thx for weighing in your thoughts. :D

zloader.c
Code:
#ifdef __WIN32__
extern HINSTANCE hInst;
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
  hInst=hInstance;
  ImportDirectX();
  zmain(__argc, __argv);     //line 962 and frame #1 in the backtrace...
  return(0);
}
#else
int main(int zargc, char *zargv[])
{
  zmain(zargc, zargv);
  return(0);
}
#endif

Code:
void zmain(int zargc, char *zargv[])
{
  if (init_paths(*zargv))            // <-- SIGSEGV Crashes here
  {
    #ifdef __LIBAO__
    ao_initialize();
    atexit(ao_shutdown);
    #endif
    handle_params(zargc, zargv);

    atexit(ZCleanup);
    srand(time(0));
    zstart();
  }
}



zpath.h line81:
Code:
bool init_paths(char *launch_command);


you can find a copy of the src I have been using here... FuSoYa made several fixes which I had no issues with my last working compile.... that and I'm pretty sure the crashing code is not part of what he changed besides it compiled and worked for me before...
http://fusoya.eludevisibility.org/emulator/zsnes8.html

EDIT:
This crash occurs regardless of whether I pass a cmdline parameter or not..
so it confusing to me.. as I haven't changed any code myself and it should work the same as with my previous working compile...

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Last edited by joe_devore on Fri Mar 17, 2017 10:40 pm, edited 1 time in total.



Fri Mar 17, 2017 2:40 am
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
I downgraded one more MinGW package..
mingw32-mingwrt-dev
mingw32-mingwrt-dll
from it said I was v3.21.1 but I may have had a beta release installed years ago or something v4.0.3...
so now I have v3.22.4 installed for the above and for
mingw32-w32api-dev its now v3.18.2

still no go...

and parsegen.exe is now not compiling, with many errors about string.h function declarations I think...
so I used a very old MinGW compiler that came with Dev-CPP from years ago to recompile parsegen.exe
it use gcc (GCC) 3.4.2 (mingw-special)

Code:
Program received signal SIGSEGV, Segmentation fault.
0x00606120 in zmain (zargc=0, zargv=0x0) at zloader.c:942
942       if (init_paths(*zargv))

(gdb) bt
#0  0x00606120 in zmain (zargc=0, zargv=0x0) at zloader.c:942

#1  0x00606195 in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, szCmdLine=0x1313480 "", iCmdShow=10) at zloader.c:962

#2  0x0075bdd4 in main ()

(gdb) bt full
#0  0x00606120 in zmain (zargc=0, zargv=0x0) at zloader.c:942
No locals.

#1  0x00606195 in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, szCmdLine=0x1313480 "", iCmdShow=10) at zloader.c:962
No locals.

#2  0x0075bdd4 in main ()
No symbol table info available.

now I'm getting the same error but less debug data... WTH this makes no sense..
MinGW sucks at times...

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Fri Mar 17, 2017 10:38 pm
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Problem. It seems you may be initializing a Unicode build, or maybe not, I'm not sure. I just know you can't trust those __argv variables to be initialized properly by the C runtime.

The safest bet is to steal the UTF-8 runtime type stuff from FLAC for Windows, and use it to initialize the zmain function from its own instance of argc/argv created with UTF-8 strings, then replace various file I/O calls (fopen, etc) with their UTF-8 versions.


Fri Mar 17, 2017 11:26 pm
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
kode54 wrote:
Problem. It seems you may be initializing a Unicode build, or maybe not, I'm not sure. I just know you can't trust those __argv variables to be initialized properly by the C runtime.

The safest bet is to steal the UTF-8 runtime type stuff from FLAC for Windows, and use it to initialize the zmain function from its own instance of argc/argv created with UTF-8 strings, then replace various file I/O calls (fopen, etc) with their UTF-8 versions.


ok thx so is that what u showed me on IRC?

Code:
#ifdef __WIN32__
extern HINSTANCE hInst;
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
  hInst=hInstance;
  ImportDirectX();
 
  int __argc = 1;
  char arg[MAX_PATH];
  char ** __argv = { &arg, 0 };
  GetModuleFileName(NULL, &arg, sizeof(arg));
 
  zmain(__argc, __argv);
  // zmain(__argc, __argv);
  return(0);
}
#else
int main(int zargc, char *zargv[])
{
  zmain(zargc, zargv);
  return(0);
}
#endif

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Fri Mar 17, 2017 11:54 pm
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
it fails to compile with the following error..

Code:
gcc -O0 -fno-omit-frame-pointer -ggdb3 -DDEBUG -funwind-tables -static  -D__WIN32__ -o zloader.obj -c zloader.c
zloader.c: In function 'WinMain':
zloader.c:963:3: error: function '__p___argc' is initialized like a variable
   int __argc = 1;
   ^
zloader.c:965:3: error: function '__p___argv' is initialized like a variable
   char ** __argv = { &arg, 0 };
   ^
zloader.c:965:3: error: invalid initializer
zloader.c:965:3: error: (near initialization for '__p___argv')
zloader.c:965:3: warning: excess elements in scalar initializer [enabled by default]
zloader.c:965:3: warning: (near initialization for '__p___argv') [enabled by default]
zloader.c:966:3: warning: passing argument 2 of 'GetModuleFileNameA' from incompatible pointer type [enabled by default]
   GetModuleFileName(NULL, &arg, sizeof(arg));
   ^
In file included from c:\dev-mingw\include\windows.h:44:0,
                 from zloader.c:36:
c:\dev-mingw\include\winbase.h:1647:25: note: expected 'LPSTR' but argument is of type 'char (*)[260]'
 WINBASEAPI DWORD WINAPI GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
                         ^
In file included from zloader.c:30:0:
zloader.c:965:11: error: nested function '__p___argv' declared but never defined
   char ** __argv = { &arg, 0 };
           ^
zloader.c:963:7: error: nested function '__p___argc' declared but never defined
   int __argc = 1;
       ^
makefile.ms:303: recipe for target 'zloader.obj' failed
make: *** [zloader.obj] Error 1

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Fri Mar 17, 2017 11:59 pm
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Make them "argc" and "argv", and remove the & from that GetModuleFileName call.


Sat Mar 18, 2017 12:02 am
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
kode54 wrote:
Make them "argc" and "argv", and remove the & from that GetModuleFileName call.

ok like this?

Code:

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
  hInst=hInstance;
  ImportDirectX();
 
  int argc = 1;
  char arg[MAX_PATH];
  char ** argv = { &arg, 0 };
  GetModuleFileName(NULL, arg, sizeof(arg));
 
  zmain(argc, argv);
  // zmain(__argc, __argv);
  return(0);
}



and here is the warning, ie it compiled this time.. will try out now and post back mu results...
Code:
gcc -O0 -fno-omit-frame-pointer -ggdb3 -DDEBUG -funwind-tables -static  -D__WIN32__ -o zloader.obj -c zloader.c
zloader.c: In function 'WinMain':
zloader.c:965:3: warning: initialization from incompatible pointer type [enabled by default]
   char ** argv = { &arg, 0 };
   ^
zloader.c:965:3: warning: (near initialization for 'argv') [enabled by default]
zloader.c:965:3: warning: excess elements in scalar initializer [enabled by default]
zloader.c:965:3: warning: (near initialization for 'argv') [enabled by default]

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Last edited by joe_devore on Sat Mar 18, 2017 12:10 am, edited 1 time in total.



Sat Mar 18, 2017 12:07 am
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
If that's a C source file, you'll have to declare them at the top of the function, though.


Sat Mar 18, 2017 12:08 am
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
To eliminate the warning, change to:

Code:
char * argv[2] = { &arg, 0 };


Sat Mar 18, 2017 12:11 am
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
kode54 wrote:
If that's a C source file, you'll have to declare them at the top of the function, though.

it is zloader.c

like this

Code:
#ifdef __WIN32__
extern HINSTANCE hInst;
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
  int argc = 1;
  char arg[MAX_PATH];
  char ** argv = { &arg, 0 };
  GetModuleFileName(NULL, arg, sizeof(arg));

  hInst=hInstance;
  ImportDirectX();
 
  zmain(argc, argv);
  // zmain(__argc, __argv);
  return(0);
}
#else
int main(int zargc, char *zargv[])
{
  zmain(zargc, zargv);
  return(0);
}
#endif

ok, moved those code up to the top of the function like u said.. no compiler warnings for zloader.c now... :D


and here is the new crash report:
Code:
Program received signal SIGSEGV, Segmentation fault.
0x74d743df in strlen () from C:\Windows\syswow64\msvcrt.dll

(gdb) bt
#0  0x74d743df in strlen () from C:\Windows\syswow64\msvcrt.dll

#1  0x00611685 in isextension (fname=0x445c3a46 <Address 0x445c3a46 out of bounds>, ext=0x7b2f0c <zst_header_cur+33315> "exe") at zpath.c:532

#2  0x006109be in cfgpath_ensure (launch_command=0x445c3a46 <Address 0x445c3a46 out of bounds>) at zpath.c:127

#3  0x00610d0b in init_paths (launch_command=0x445c3a46 <Address 0x445c3a46 out of bounds>) at zpath.c:203

#4  0x0060612a in zmain (zargc=1, zargv=0x28fda4) at zloader.c:942

#5  0x006061c0 in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, szCmdLine=0x1613480 "", iCmdShow=10) at zloader.c:968

#6  0x0075bdf4 in main ()

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Sat Mar 18, 2017 12:16 am
Profile WWW
Zealot
User avatar

Joined: Wed Jul 28, 2004 3:31 am
Posts: 1140
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Aha, one level of indirection missing. Adding & fixes it.

Code:
zmain(argc, &argv);


It's reading one level too deep, producing your "f:\d" into a pointer.


Sat Mar 18, 2017 12:26 am
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Code:
(gdb) b WinMain@16
Breakpoint 1 at 0x606170: file zloader.c, line 960.
(gdb) r
Starting program: F:\Dev-src\2Emulators\zsnes_Testing__v1.51_(FuSoYa-8MB_R2)/zsnesw_v1.51_Debug_(+nocona-opt_mmx&sse2)+(2017-03-17).exe
[New Thread 764.0x133c]

Breakpoint 1, WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, szCmdLine=0x16b3480 "", iCmdShow=10) at zloader.c:960

960       int argc = 1;

(gdb) n
962       char ** argv = { &arg, 0 };

(gdb) print argv[0]
$1 = 0xababab00 <Address 0xababab00 out of bounds>

(gdb) n
963       GetModuleFileName(NULL, arg, sizeof(arg));

(gdb) print argv[0]
$2 = 0x773b3406 <ntdll!RtlQueryPerformanceCounter+2738> "A\020"

(gdb) n
965       hInst=hInstance;
(gdb)
966       ImportDirectX();
(gdb)
968       zmain(argc, argv);
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x74d743df in strlen () from C:\Windows\syswow64\msvcrt.dll


so here is the least results.. but u mentioned changing
zmain(argc, argv); to zmain(argc, &argv);

so did it recompiling and testing now...

new compiler warnings..
Code:
gcc -O0 -fno-omit-frame-pointer -ggdb3 -DDEBUG -funwind-tables -static  -D__WIN32__ -o zloader.obj -c zloader.c
zloader.c: In function 'WinMain':
zloader.c:962:3: warning: initialization from incompatible pointer type [enabled by default]
   char ** argv = { &arg, 0 };
   ^
zloader.c:962:3: warning: (near initialization for 'argv') [enabled by default]
zloader.c:962:3: warning: excess elements in scalar initializer [enabled by default]
zloader.c:962:3: warning: (near initialization for 'argv') [enabled by default]
zloader.c:968:3: warning: passing argument 2 of 'zmain' from incompatible pointer type [enabled by default]
   zmain(argc, &argv);
   ^
zloader.c:940:6: note: expected 'char **' but argument is of type 'char ***'
 void zmain(int zargc, char *zargv[])
      ^

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Sat Mar 18, 2017 12:31 am
Profile WWW
Regular
User avatar

Joined: Thu Aug 05, 2004 12:07 am
Posts: 251
Location: NH, USA
Reply with quote
Post Re: Issues with compiling ZSNES (v1.51) these days... :(
Code:
gcc -O0 -fno-omit-frame-pointer -ggdb3 -DDEBUG -funwind-tables -static  -D__WIN32__ -o zloader.obj -c zloader.c

zloader.c: In function 'WinMain':
zloader.c:962:3: warning: initialization from incompatible pointer type [enabled by default]
   char * argv[2] = {&arg, 0};
   ^
zloader.c:962:3: warning: (near initialization for 'argv[0]') [enabled by default]


besides these warnings...

NO CRASHING! :D :D lol

_________________
(PC Specs)
CPU: AMD FX-9590 4.7GHz 8-core
CPU Instructions: MMX(+), SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, x86-64, AMD-V, AES, AVX, XOP, FMA3, FMA4
Motherboard: Asus SABERTOOTH 990FX R2.0
GPU: nVidia GTX 1070 Ti 8GB
GFX Drivers: Nvidia v436.15
OS: Windows 7 Ultimate 64-bit SP1
RAM: 32GB Kingston 1866MHz DDR3

Favorite Emulators:
PS2 : PCSX2 (Auto-Builds)
SNES : ZSNES
N64 : Project64

ZSNES:
v1.51 (FuSoYa's 8MB fix R2)(Compiled Myself)


Sat Mar 18, 2017 12:41 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.