Joint venture: To bring a new PS2 port of Snes9x.

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Ah...
The patch added the bleh.cpp in there but I (or it) hadn't modified the makefile.
I also noticed $(LOGGEROBJ) wasn't setup in my copy of the makefile either... is this something you added?
Well, that fixed that it looks like. (THANK YOU once again Ragnarok... I wish I wasn't so new to this stuff... alot of these fixes I'm having trouble getting around... and creating new functions I'm not very good at... Sorta learning this as I'm going... anyhoo... thank you = D )

Okay... so I'm going to post this to see if it looks identical to where you're at:

Code: Select all

REMOVED TO SAVE SPACE
It's malloc and initialization for the sound CPU core right?
Last edited by Rev1Dev on Fri Apr 18, 2008 3:18 am, edited 1 time in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Yep, looks like you're at the same point I am. You're missing an object file or two I added back into the process but other than that, it looks good. I'm not sure what you mean by malloc and sound core initialization? I added some more checks for logger and screenshot functions that won't be needed in the Makefile and source code which will be in the new patch, :D. When the source gets to a compile-able state, I'll probably start looking at individual functions to determine which ones are needed or not and start commenting them out as well.

On another note:
I took a look at the docs folder, and it mentions in the readme.txt file that snes9x can run on a 486 (133 mhz) machine but that's only for the bare minimum of games. They recommend at least a 600 mhz processor for the ability to run most games at the basic settings. The ps2's EE is clocked at 294 mhz, and while mips processors do tend to run code faster than x86 cpus, I'm sure it's not enough. I would consider Snes-Station to actually be near the far end of the spectrum on performance on the ps2, in my opinion.

Having said that, commenting out a lot of the unneeded stuff should help improve performance. I think that Hiryu said he was running a thread on the IOP to do the sound in Snes-Station way back when or maybe it was that he was planning to do that... Well, that's for the far future :D.
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Yeah... I see what you mean.

In comparison, however, I think once it's in a state where optimization can occur, it ought to be alright.

Some system specs:
GameCube:

CPU: 128-bit custom IBM Gekko PowerPC (485MHz)

GPU: ATI Flipper (162MHz)

The snes emulator for this system if I'm not mistaken is also based off snes9x source. My memory doesn't serve me too well here (I ended up always using XBOX's once I'd finally got one and had the emu for it) but performance seemed pretty stable when I was using this one.
XBOX:

CPU: 733 MHz Intel Custom Pentium III
GPU: 250 MHz Custom-Designed NV2X

This one is snes9x based. Did the job, too, and now I see why according to what you posted were optimal specs for good performance.
Perhaps the one that interests me most here, however, would have to be the PSP...

The snes9x-TYL releases...
They all seem to run most every... if not all games just fine... (I think there were a few that gave me trouble, i.e. Doom, Donkey Kong Country series, Super Mario RPG...)

It's clocked at 333mhz... with the base of 266mhz standard. Also MIPS architecture.

At that rate... the PS2 should be more than ample to handle it.
Let's hope...

EDIT:

Okay, I am completely stumped with this part:

Code: Select all

REMOVED TO SAVE SPACE
It's in control.cpp & snapshot.cpp

Code: Select all

[`_splitpath(char const*, char*, char*, char*, char*)']
The weird thing is the command is already defined as this in the actual .cpp files

Code: Select all

        char def [PATH_MAX];
        char filename [PATH_MAX];
        char drive [_MAX_DRIVE];
        char dir [_MAX_DIR];
        char ext [_MAX_EXT];

        _splitpath(Memory.ROMFilename, drive, dir, def, ext)
I'm too new to this [C++] to really know how to approach this one. -=shrug=- I've checked all the headers and nothing. Should I create a new one and #include it in all those files?
Last edited by Rev1Dev on Fri Apr 18, 2008 3:17 am, edited 1 time in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

The IOP is a co-processor for the EE, that's designed to offload the I/O functions from the EE. It's basically the same cpu that the PS1 uses, but I think at a higher clockrate. I forgot what it was though. The various device drivers each run their own thread which can interface with client code from the EE. You can look at the clientside code in the ps2sdk source's ee/rpc and serverside code in the iop folder. I think the simplest example to look at is iop/dev9/poweroff and ee/rpc/poweroff. Offloading some of the emulation onto the IOP would help a bit, but that's for later :D.

The apu code looks like it defines some internal functions for sound emulation that spc700.cpp uses.

I've gotten down to 38 errors. Some of these are from functions not implemented in ps2sdk's libc yet. For the _impure_ptr errors, http://www.embedded.com/story/OEG20011220S0058 down at Reentrancy.

I also grabbed a prototype function for _splitpath from http://forums.hostrocket.com/archive/in ... 15876.html. It's not useable right now for the ps2, but it can be modified. device:dir/file or device:/dir/file or device:\dir\file (one of those cdvd modules) isn't too far different from C:\dir\file.ext.

Here's the latest patch. Make sure to apply it to the clean snes9x-1.51 source.

Code: Select all

conffile.o(.text+0xfc4): In function `ConfigFile::SaveTo(char const*)':
conffile.cpp: undefined reference to `ctime'
bsx.o(.text+0x15bc): In function `S9xInitBSX':
bsx.cpp: undefined reference to `localtime'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x178):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x180):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x198):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x1a0):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x1bc):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(ios.o)(.text+0x1c4):../../../../libstdc++-v3/libsupc++/new:89: more undefined references to `_impure_ptr' follow
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale.o)(.text+0x1440):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/basic_string.h:781: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_numERS3_S5_RiiijRKSt5ctypeIcERSt12_Ios_Iostate+0x1dc): In function `__static_initialization_and_destruction_0':
c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/char_traits.h:123: undefined reference to `atoi'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0x34):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/c++locale.h:49: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0x74):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/locale_facets.tcc:2021: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0xa0): In function `__static_initialization_and_destruction_0':
c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/c++locale.h:67: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0x34):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/c++locale.h:49: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0x74):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/locale_facets.tcc:2021: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0xa0):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/c++locale.h:67: more undefined references to `setlocale' follow
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(stl-inst.o)(.gnu.linkonce.t._ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0xf4):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/stl_alloc.h:109: undefined reference to `__assert'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(stl-inst.o)(.gnu.linkonce.t._ZNSaIcE8allocateEjPKv+0xf8):c:/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/bits/stl_alloc.h:109: undefine
d reference to `__assert'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(collate_members.o)(.text+0xc):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/collate_members.cc:46: undefined reference to `strcoll'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(collate_members.o)(.text+0x40):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/collate_members.cc:54: undefined reference to `strxfrm'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(time_members.o)(.text+0x38):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/time_members.cc:47: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(time_members.o)(.text+0x50):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/time_members.cc:48: undefined reference to `setlocale'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(time_members.o)(.text+0x64):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/time_members.cc:49: undefined reference to `strftime'
C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a(time_members.o)(.text+0x70):c:\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/time_members.cc:50: undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x1d4&#41;&#58; In function `void std&#58;&#58;__convert_to_v<long long>&#40;char const*, long long&, std&#58;&#58;_Ios_Iostate&, int* const&, int&#41;'&#58;
c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;89&#58; undefined reference to `strtoll'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x28c&#41;&#58; In function `void std&#58;&#58;__convert_to_v<unsigned long long>&#40;char const*, unsigned long long&, std&#58;&#58;_Ios_Iostate&, int* const&, int&#41;'&#58;
c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;106&#58; undefined reference to `strtoull'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x340&#41;&#58; In function `void std&#58;&#58;__convert_to_v<float>&#40;char const*, float&, std&#58;&#58;_Ios_Iostate&, int* const&, int&#41;'&#58;
c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;123&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x35c&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;124&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x38c&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;133&#58; undefined reference to `finitef'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x3c4&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;150&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x470&#41;&#58; In function `void std&#58;&#58;__convert_to_v<double>&#40;char const*, double&, std&#58;&#58;_Ios_Iostate&, int* const&, int&#41;'&#58;
c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;163&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x48c&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;164&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x4d8&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;172&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.text+0x570&#41;&#58; In function `void std&#58;&#58;__convert_to_v<long double>&#40;char const*, long double&, std&#58;&#58;_Ios_Iostate&, int* const&, int&#41;'&#58;
c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;185&#58; undefined reference to `setlocale'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;c++locale.o&#41;&#40;.t
ext+0x58c&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/c++locale.cc&#58;186&#58; more undefined references to `setlocale' follow
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;ctype.o&#41;&#40;.text+0x0&#41;&#58;c&#58;/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/ctype_noninline.h&#58;38&#58; undefined reference to `_ctype_'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;ctype.o&#41;&#40;.text+0x8&#41;&#58;c&#58;/ps2dev/src/gcc-3.2.2/build-ee-stage2/ee/libstdc++-v3/include/ee/bits/ctype_noninline.h&#58;38&#58; undefined reference to `_ctype_'
C&#58;\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\lib\libstdc++.a&#40;basic_file.o&#41;&#40;.text+0x314&#41;&#58;c&#58;\ps2dev\src\gcc-3.2.2\build-ee-stage2\ee\libstdc++-v3\src/basic_file.cc&#58;100&#58; undefined reference to `setvbuf'
mingw32-make.exe&#58; *** &#91;SNES9X.ELF&#93; Error 1
Process terminated with status 2 &#40;3 minutes, 43 seconds&#41;
38 errors, 13 warnings
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Good Job Ragnarok... you're going to end up cracking this one = )
Man I can't wait until I know what I'm doing -=laughing=-

Well, I wasn't able to d/l the new patch; do you think you would mind re-uploading?

Here's an example of what I've been doing (just took and added it onto bleh.cpp).
For the second one it's now set to FALSE (*correction).

Code: Select all

//REVONE&#58; Referenced @ apu.cpp, Line 484 ; snapshot.cpp, Line 2065 
bool8 S9xSPCDump &#40;const char *filename&#41;
&#123;
    return false;
&#125;
//REVONE&#58; Referenced @ snapshot controls.cpp, Line 1684; snapshot.cpp, Line 183
bool8 S9xUnfreezeGame &#40;const char *filename&#41;
&#123;
    return FALSE;
&#125;
Just had to say: Great Job Ragnarok!

EDIT: According to the article, you have edit each instance of the reent failure to include the struct or can you simply set a pointer where it occurs?
Last edited by Rev1Dev on Fri Apr 18, 2008 7:49 am, edited 2 times in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Hrmm, that's strange, I can't download it from my link, either, but I can get it from the main page. Go to http://homebrew.thewaffleiron.net/ragnarok2040 and download it from that page. It might be some sort of hotlink protection.

Actually, not all of the undefined references are undefined. Some of them are defined, but aren't linked in, so they need to be commented out when they're called, instead of defined. For other undefined functions, it depends on if you need them or want them or not. The function definitions in bleh.cpp are ones that porting.html said were needed for a port, so I provided them. Also, a bool8 function should return either true or false (or an unsigned char, since that's the type). I only returned NULL on functions that returned a pointer, such as char *function() which will cause either a NULL exception error if the pointer is used or tell the function that called it that NULL was returned.

In the new patch, I added snapshot.cpp back into the build because it's needed for savestates (snapshots) so S9xSPCDump and S9xUnfreezeGame are defined again. I also added #ifdef/#undef guards to the function calls that are defined in objects that aren't linked in, so their calls won't be included into the final object at compile-time. For examples of what I did, search for the CHEAT_SUPPORT symbol or MOVIE_SUPPORT symbol inside of the source code using an ide like CodeBlocks. You could also open up the patch inside of Wordpad to see what I've done.

If you want a good C programming book, you should look for Practical C Programming by O'Reilly and for C++, you should get C++: The Complete Reference by Osborne. And for pointers, http://www.gamedev.net/reference/articl ... le1697.asp, which I found useful. There's also plenty of sites that have information about programming in C, as well.

Snes9x is coded mostly in C, but compiled with the C++ compiler because of some features they wanted that weren't available with just gcc, but because of that it has the same quirks a C++ program would have. I think that answered everything from your last two posts, :D.

Extra note:
Can someone try compiling snes9x-1.51 with my patch using their ps2dev toolchain on Linux or Cygwin? That'll tell me if some of the errors are from a bug in MinGW not compiling libstdc++ correctly (weird bug where gcc tries to use a windows path for some reason but doesn't properly '\\' so I get c:msyslocalps2deveebinar.exe type errors).
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

I'm trying to apply the patch, but keep getting this:

Code: Select all

REMOVED TO SAVE SPACE
Any pointers?
Last edited by Rev1Dev on Fri Apr 18, 2008 3:15 am, edited 1 time in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Hrmm, working fine for me. I'm using the source from http://files.ipherswipsite.com/snes9x/s ... rc.tar.bz2 but other than that it looks like it's not finding the snes9x source files correctly. The snes9x folder you're in should have all the .cpp files in it.
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Nevermind...
Sorry about the first post. Here's the correct output I received, this time with the patch applied correctly:

Code: Select all

REMOVED TO SAVE SPACE
Last edited by Rev1Dev on Fri Apr 18, 2008 7:47 am, edited 1 time in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Weird, _makepath and _splitpath are defined in bleh.cpp. All references to "cheats.h" are commented out via the preprocessor at compile-time so you shouldn't even have undefined references to S9xAddCheat and etc. You sure you aren't using the old patch?
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Okay... you were right. Wrong patch X D

Okay this is where it's really at -=smiling=-

Code: Select all

REMOVED TO SAVE SPACE
Sorry about that, still had the 1st patch in the same directory. Hope this helps.
Last edited by Rev1Dev on Fri Apr 18, 2008 7:53 am, edited 1 time in total.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

All of that can be shortened down to this list of 13 functions: ctime, localtime, setlocale, setvbuf, finitef, strtoull, strtoll, strftime, strxfrm, strcoll, __assert, atoi, and _impure_ptr.

It's at the point, now, where real work can start, :D.
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Are these (some of) the files I want to be looking at right?

Code: Select all

ctime.c ; lctime_r.c ; lcltime.c ; strftime.c ; setvbuf.c ; errno.c ; errno.h ; reent.h ; basic_string.h ; new
So it's basically down to... toolchain commands? Are those what these are?
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

They're parts of the standard c++ library (libstdc++) and the standard c library (libc or newlib). All we have to do is write a frontend or rewrite the internal parts to not use the specific libstdc++ functions that require those undefined newlib definitions or just implement them in ps2sdk's libc (preferrable method as it helps the community).
Rev1Dev
Posts: 22
Joined: Sun Apr 13, 2008 5:00 pm

Post by Rev1Dev »

Nice. = ) So there's the added bonus that those adapted libraries will be available if ever needed for other projects in the future... I guess it'll also make it easier when compiling this from source for future updates, while making the SDK itself a more fully featured adaption of existing C/C++ standard.
On another note, I was wondering if condensing the script to only include the features necessary to the PS2 version would require any major rewrites to the foundation code in helping to optimize it?

I was looking at the article you posted in regards to reentrancy and was searching for some examples that used it to gain a better understanding of how to rewrite into a format more suitable for the SDK.
You've been working pretty fast at this so I'm certain you've either begun work towards or have even already completed some implementation of it.
The learning curve still seems pretty steep from this side of the fence, but I just wanted to say what a big help you've been to me in particular in being patient with a newcomer and all the questions that come along with taking on anything new as well as sharing so much valuable information to help me along. Very Much appreciated! = )
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Sorry I was away a bit, heh. I was busy playing with Linux on my ps2, :D. I'm nowhere good enough to start implementing standards compliant functions into newlib/libstdc , so I decided to see if I could find a workaround. I took a look at the snes9x port on Wii/GC to see if I could come up with any ideas, as well. It's based on 1.43, and there are huge differences between 1.51 and 1.43. It looks like it was based on the xSnes9x port. There's no controls.cpp, and reader.cpp was replaced with a custom gamecube-based file loader, from the looks of it. Taking out both of those from the project removed all of the libstdc errors I was getting.

The following functions are ones that I commented out:
  • line file function
    1082 bsx.cpp localtime
    513 cpuexec.cpp S9xDoAutoJoypad
    484 gfx.cpp S9xControlEOF
    2075 memmap.cpp S9xVerifyControllers()
    1913 ppu.cpp S9xSetJoypadLatch
    2437 ppu.cpp S9xReadJOYSERn
    2713 ppu.cpp S9xControlsSoftReset
    2704 ppu.cpp S9xControlsReset
    372 snes9x.cpp S9xSetController
    932 snes9x.cpp S9xVerifyControllers
    1255 snes9x.cpp S9xVerifyControllers
    1111 snapshot.cpp S9xControlPreSave
    1429 snapshot.cpp S9xControlPostLoad
And, the fReader calls in memmap.c need to be replaced with a custom file loader for ps2. Lines in memmap.c: 3426 3441 3462 3482 3557 3572 3593 3613, seem to be the only place it's used. I'll work more on it.

Update, I replaced reader.c/.h with just an empty fReader class with a constructor that takes a FILE* reference, and it compiled :D.

There seems to be something weird afoot. Every symbol that's undefined in libstdc++ is supported inside of ps2sdk's stdlib.c/.h. I recompiled my toolchain, fixing my c:ps2deveeeebinnm.exe error, and that didn't fix the problem. I'm out of clues :S.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Sorry about posting back to back, but I reverted back to 1.43 and it was relatively easy to get it to compile. It only took me around 2 1/2 hours to create a new makefile, add the function stubs for the port, and comment out miscellaneous movie functions. Just wanted to post to give a heads up.
dlanor
Posts: 258
Joined: Thu Oct 28, 2004 6:28 pm
Location: Stockholm, Sweden

Post by dlanor »

@ragnarok2040: Please check your PM box.

Best regards: dlanor
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

The GSTEXTURE structure was throwing me off a bit. The Mem pointer is u32*, and the texture data I was giving it was being cast to 32-bit numbers by default when compiling. By casting the pointer to u16* I was able to fix this
Image
to
Image
this.

:D.
User avatar
bootsector_
Posts: 15
Joined: Mon Feb 25, 2008 12:56 am

Post by bootsector_ »

I knew you would show up and take this personally!

Keep up the great job!
syproject
Posts: 5
Joined: Fri Mar 28, 2008 8:02 am

Post by syproject »

nice work ragnarok2040 i know many people will ask the same qestion.... when will a beta be released?

keep up the good work bud
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

I've already released a couple of builds so people could try it out. Alpha2 is the latest version. It supports one controller mapped to a standard snes controller, just push L2 to get back to the file browser. There's no sound support, or hi-res support or transparency support, and booting new roms is a little broken. It's also kind of fast because the sound core isn't enabled, heh. With it enabled, it's pretty slow.

If you want to try it out, I uploaded the source and the latest alpha2 builds to:
http://homebrew.thewaffleiron.net/ragnarok2040/

They're named packed_snes9xPAL.zip and packed_snes9xNTSC.zip.
syproject
Posts: 5
Joined: Fri Mar 28, 2008 8:02 am

Post by syproject »

nice work ragnarok2040 when you starting on the n64 heheh j/k

will have a play about tonight
goldman
Posts: 1
Joined: Mon Aug 25, 2008 1:06 pm

Post by goldman »

bumped
this thread shouldn't fade away
dirsors
Posts: 13
Joined: Tue Mar 04, 2008 1:21 pm
Location: Porto Alegre, RS, Brazil

Post by dirsors »

Eagerly wating for a stable version!
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Sorry, real life got in the way, heh. My old computer broke down in July, then it took about a month to build another one, then I was supposed to move in August, which didn't really happen until early September. On top of that, I had been learning MIPS assembly, which I need to still complete. Other than that, I'm about to rewrite the ports a bit so I can separate the code a little more cleanly from the browser, redo the startup code a bit so it starts faster, various other changes so it'll be easier to work on the core "porting" of Snes9x as my old code keeps getting in the way, heh.
Post Reply