Hacking NDSSFC/CATSFC revival

What sort of additional hotkeys do you want?


  • Total voters
    98

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Hello GBAtemp.

For my first post, I present to you multiple new versions of CATSFC, the Super Nintendo emulator for the DSTWO based on Snes9x 1.43. I did not rename the project or its system folder; I left it as CATSFC.

View the source! http://github.com/ShadauxCat/CATSFC
(with an issue tracker too)

Get the plugin! http://filetrip.net/nds-downloads/flashcart-files/latest-catsfc-f31847.html
and, if you like, Aeter's LEDS2-Orange skin for CATSFC

* 1.36: File selector improvements. Notably, directories with more than 511 files or 63 subdirectories will not crash CATSFC upon being displayed. Going to the last page with the R button also won't lock you to that page until you press Down, Up, Up.
* 1.36: The Screenshot slideshow function doesn't freeze with an exception if you have no screenshots.

* 1.34: The GUI now has 8 rows, for denser information in the file selector and cheat interface.
* 1.34: The saved state menu now always shows the screenshot of the saved state you're dealing with, even when creating or deleting them (!).
* 1.34: Rapid button presses and releases should be ignored much less often.
* 1.34: Button auto-repeating in the menu is now set to 1/20 second instead of 1/5, with the first repetition at half a second.
* 1.34: The position in a submenu is kept in case you want to enter the submenu again.

Other changes, overall:

Emulator
* The highest CPU speed is selected by default. This drains the battery faster, though. Other CPU frequencies are still available and apply per-game as in NDSSFC 1.06 (since 1.08).
* Keep the Audio Processing Unit (APU) emulation running when you mute the sound via the interface. This allows you to load a saved state made with the sound off, and then enable the sound without the emulation freezing. (Older saved states will still freeze! Only new ones will work correctly in the face of disabled sound.) (since 1.11)
* Cheats! Game Genie, Pro Action Replay and Goldfinger. The supported format has changed from CATSFC 1.1/NDSSFC 1.06 and is described in post #17. Read README.md in the download for more information (since 1.09). Multi-part cheat codes are grouped in the cheat interface (since 1.31).
* Saved state slots can now be chosen and manually overwritten by you, the player. You also have 16 slots for saved states instead of 10. This allows you, for example, to save your backtracking in a game to slots 2-5, and the main path to slot 1. Or save multiple endings to states 12-16. See a note about saved state number "changes" in post #164 (since 1.19).
* Hotkeys! Temporary fast-forward, return to menu and toggle sound (since 1.23), as well as save/load to state #1 and toggle full-screen (since 1.31).
* Better sound output timing for games that run fast enough, with 32 kHz interpolated sound like the SNES. Helps with games that use loud samples or the noise channel (since 1.29).
* Speed up CPU opcode emulation, background/tile rendering, sprite rendering and audio rendering by reducing memory accesses. Also eliminate checks for 16-bit video, 16-bit audio, stereo and reverse stereo.
* Optimise for speed. Many explicit delays have been removed, more importantly the 50 ms delay before and after loading a ROM, and the 179 milliseconds it took to zero the memory that holds the current ROM. Loading a ROM also occurs on the highest CPU frequency, regardless of settings.
* The ROM (*.smc, *.sfc) and cheat (*.cht) file selection screen now scroll the selected file name more evenly and faster (since 1.21).

Game compatibility
* Secret of Mana, Seiken Densetsu 3 (Secret of Mana 2), Treasure of the Rudras: Display the menu text as 4 pixel wide tiles.
* Seiken Densetsu 3 (Secret of Mana 2) and translations: Fix unreadable message boxes caused by SNES resolution changes (since 1.20).
* BS Zelda no Densetsu compatibility was lost (since 1.11).

Display
* Manual frame skipping, a new option in the Video & audio menu (since 1.15).
* Add a toggle to make audio or video fluid. By default, video is fluid, which makes audio jitter up to 23 milliseconds (which is less than 92 milliseconds!). This is not audible in many games (since 1.25).
* PAL timings, 50 FPS, are now accepted by CATSFC (since 1.15).
* Square pixels by default, showing the middle of the screen; the image is not smooshed (since 1.08). Other display modes are still available and are more clearly labelled in the Options screen (since 1.13).
* Display Mode 4 is now an anti-aliased whole-screen mode (since 1.13)! Great for when you have to see the entire screen for a game, but Display Mode 0 looks bad. See post #72 for an idea of what this looks like.

Emulator menu
* Narrower, better-looking font (it's Pictochat's font) (since 1.08+fontfix).
* Taelis's French translation now appears in the interface under Options/Language (since 1.08). The font was needed for this one, because Verdana.odf had no definitions for accented characters.
* Other localisations available in CATSFC are German (Deutsch, since 1.29), Dutch (Nederlands, since 1.29), Spanish (Español, since 1.29), Italian (Italiano, since 1.31), Brazilian Portuguese (Português brasileiro, since 1.31) and Simplified Chinese (since 1.33). Thanks to SignZ, Aeter, Boriar, Alessandro Pelliccia (github: alexinfurs), Diego Liberal and Syphurith, respectively, as well as Charli and jomaper for changes and suggestions.
* "NEW", "RETURN" and "RESTART" are now localised as "New game", "Return to game" and "Reset game". All three are on the same style of button (since 1.21).
* More readable text in all menus: the main menu has white on a darker purple for inactive items, and the other menus have dark purple on white instead of the old light teal (since 1.21).
* The menu does not react to extended (> 1/5 second) button presses by opening or closing multiple menus anymore (since 1.29).

DS functionality
* Suspends when the lid is closed, during emulation (since 1.14) and the menu (since 1.27). Battery usage and timings yet unknown.
* Perfect controller status synchronisation by default (since 1.29), at the cost of making automatic frameskip omit 2 frames in a row. This is needed to avoid congesting the DSTwo-DS link so much that the DSTwo can't request button presses. You can still set 1 or 0 frameskip manually, but beware: you may find yourself unable to press or release buttons every so often for many consecutive seconds!
* Better touch handling: the Touch Screen now works to load a cheat file (Main Menu/Cheats) and now updates the user interface's language (Main Menu/Options). Tapping a cell in the Load saved state row now shows its screenshot (Main Menu/Saved states). Tapping an empty row beyond the last item in a submenu does not invoke a phantom option from the next menu in RAM anymore (since 1.21).

Audio
* Lower audio loss, using Settings.SoundSync = TRUE (since 1.08), only when /Video & audio/Fluidity is set to Prefer fluid audio (since 1.25).

Meta/Extras
* Icon change (as of 1.11). The plugin now has a much more beautiful SNES controller without the CAT as its icon.
* New icons for the main menu, from the Tango Icon Library and the Tango-inspired RRZE Icon Set. See copyright for more information (since 1.21).
* The loading screen's Engrish ("Enjoy yourself! All pleasure in it"), while it was funny, is gone (as of 1.11) and replaced with a SNES controller and the word "Loading...". Update at least CATSFC/system/gui/boot.bmp on your card to get this one.
* Language files improved, with frame skipping options added. Update at least CATSFC/system/language.msg on your card to get this one.
* A much better, Engrish-free, README file for compiling and installing the emulator (as of 1.09), as well as creating more translations.
* Fewer writes to settings files. Settings files are rewritten only once you exit a submenu, and only if you've changed a setting in that submenu. If you don't change settings from their defaults for a game, the game can now have no settings file at all. This also uses up fewer erase cycles on storage cards (since 1.29).

Technical

* 1.29: DMA for de-interleaving ROMs. Makes loading large ROMs with esoteric memory maps that much faster.
* 1.29: Plugin argument support improved, thanks to BassAceGold.
* 1.27: DMA for copying frames to the screen.
* 1.27: Avoid sending 23 milliseconds of silence when returning from pause. Not having this silence does not cause any more crackling.
* 1.25: Replace some memmoves with memcpys.
* 1.24: Cut down on SA-1 and Super FX chip execution decisions. A few million instructions per second are thus avoided. (cpuexec.cpp)
* 1.24: Make sound mixing much faster by avoiding the "zero memory, add into memory for each SNES sound channel" pattern. Now only one store is done per playback sample, and the rest is done in registers. (soundux.cpp)
* 1.18: Stopped using the timer interrupt because it glitched the sound and killed the main menu.
* 1.16: Audio now runs on a timer interrupt called every 2 milliseconds. This means that the sound outputs quickly and returns to the game, also synchronising the auto frameskip and the controller status.
* 1.14: Started to synchronise each bit of the SNES controller again.
* 1.11: Less access to memory in inner loops.
* 1.11: Significantly less time to set up sprites for an image.
* 1.11: Significantly less time for drawing regular 8x8 tiles all over the screen. Instead of 14336 function calls per layer, each drawing 4 pixels, it's now 896 calls per layer to a small nested loop that draws the entire tile.
* 1.09, 1.10: More speed. Trimmed 1-8 memory store MIPS instructions per emulated SNES instruction. Trimmed 1 return from procedure MIPS instruction per emulated SNES instruction.
 

Rydian

Resident Furvert™
Member
Joined
Feb 4, 2010
Messages
27,880
Trophies
0
Age
36
Location
Cave Entrance, Watching Cyan Write Letters
Website
rydian.net
XP
9,111
Country
United States
Sounds good, too bad I don't have the time to play with it today.


Go to the existing entry for an upload (like you linked), and click "Add new version" in the right-hand bar where the details are.
On the upload page, make sure the "The version you are uploading is the newest available" checkbox is checked.


If you could implement game genie codes as well that'd be nice, since the base emulator doesn't and none of the other editors added it.

http://filetrip.net/nds-downloads/cheat-files/download-dstwo-snes-cht-pack-114-f31009.html
The scripts I wrote there include one (which is heavily-commented!) that converts GG codes to PAR format, so you can see the actual process (opposed to most google results that just tell you to use a converter program).

"Well why not just run the converter and then stick the converted codes in?" - Most GG codes modify ROM instead of RAM, and unfortunately the *SFC emulators for the DSTwo always assume that RAM (bank 7E) is being modified. This means that while a PAR code is normally in the form of BANK:ADDR:VALUE (7E001902, 7E is the bank, 0019 is the address, 02 is the value to set), the *SFC emulators only take 6-digit codes (19:02 to use the same example, since it'd ignore the leading 0's on the address) because they always assume that the bank is 7E... so there's no way I know of to use GG-converted codes (or just, you know, GG codes as-is).
 

the_randomizer

The Temp's official fox whisperer
Member
Joined
Apr 29, 2011
Messages
31,284
Trophies
2
Age
38
Location
Dr. Wahwee's castle
XP
18,969
Country
United States
please, DO post a .plg to test. id love to try this on my dstwo.
looks like youve done some significant changes.
imho, you should add yer own name for this fork of ndssfc. NebSFC perhaps.
BassAceGold also built a version of ndssfc called BAGSFC.

I'm surprised they ported Snes9x 1.43 to this thing; too bad 1.52 is out of the question (has perfect audio emulation).
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
I'm surprised they ported Snes9x 1.43 to this thing; too bad 1.52 is out of the question (has perfect audio emulation).
Right, it sucks pretty bad. I tried to transplant 1.53 into this thing, and failed really hard. Then tried again, and failed again (though not as hard). Then I transplanted 1.53's tile.cpp / gfx.cpp / ppu.cpp, and I managed to get the new GFX code working, but it was half the frames per second of the 1.43 version so I gave up.

There's too much C++ and not enough support for C++ in the DS2 SDK, unfortunately!

VatoLoco: http://filetrip.net/nds-downloads/flashcart-files/download-catsfc-108-f31257.html Happy testing ;)
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
http://filetrip.net/nds-downloads/cheat-files/download-dstwo-snes-cht-pack-114-f31009.html
The scripts I wrote there include one (which is heavily-commented!) that converts GG codes to PAR format, so you can see the actual process (opposed to most google results that just tell you to use a converter program).

"Well why not just run the converter and then stick the converted codes in?" - Most GG codes modify ROM instead of RAM, and unfortunately the *SFC emulators for the DSTwo always assume that RAM (bank 7E) is being modified. This means that while a PAR code is normally in the form of BANK:ADDR:VALUE (7E001902, 7E is the bank, 0019 is the address, 02 is the value to set), the *SFC emulators only take 6-digit codes (19:02 to use the same example, since it'd ignore the leading 0's on the address) because they always assume that the bank is 7E... so there's no way I know of to use GG-converted codes (or just, you know, GG codes as-is).
Would it be possible to use the S9xGameGenieToRaw function to support this correctly, or is there actually no support in S9x 1.43 to edit ROM?

I investigated that function, but didn't see where the memory watches ended up.

BassAceGold also built a version of ndssfc called BAGSFC.
As far as I know, CATSFC is bsed on BAGSFC. Did BassAceGold edit CATSFC after 2011?
 

the_randomizer

The Temp's official fox whisperer
Member
Joined
Apr 29, 2011
Messages
31,284
Trophies
2
Age
38
Location
Dr. Wahwee's castle
XP
18,969
Country
United States
Right, it sucks pretty bad. I tried to transplant 1.53 into this thing, and failed really hard. Then tried again, and failed again (though not as hard). Then I transplanted 1.53's tile.cpp / gfx.cpp / ppu.cpp, and I managed to get the new GFX code working, but it was half the frames per second of the 1.43 version so I gave up.

There's too much C++ and not enough support for C++ in the DS2 SDK, unfortunately!

VatoLoco: http://filetrip.net/nds-downloads/flashcart-files/download-catsfc-108-f31257.html Happy testing ;)

Well, at least I know that someone tried;) The DSTWO or whatever it's called simply doesn't have the power to run it; Snes9x 1.52 had massive changes to the code from 1.43/1.51.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
hmm, searching around, there was somebody working on 1.52 for dingoo linux (Dingux just recently ported to DSTWO), although its from 2010.
5-7 FPS :( And it looks rather abandoned. Who knows what happened afterwards... (booting Snes9x on top of Linux on top of the Supercard EOS double-buffering thingy certainly won't help because of all the indirection involved)
 

KazoWAR

Well-Known Member
Member
Joined
Aug 12, 2008
Messages
1,952
Trophies
1
Age
35
Location
Winter Haven
XP
2,124
Country
United States
I am having a problem with menu text, anyone else?
00000_zps14d18600.png
 
  • Like
Reactions: The Catboy

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
I am having a problem with menu text, anyone else?
00000_zps14d18600.png
Ahh! The return of the bad text. During one of my tests of the font, the menu did look like that. It looks as if I only set the leftmost bit of each character.

But that should be long gone... :blink:

edit: I see what I did wrong now. I packaged the wrong font file; one of my earlier tests was still on my hard drive, and I packaged from it instead of my card. I have updated the link to Filetrip. This change doesn't affect the source code on Github.
 

BassAceGold

Testicles
Member
Joined
Aug 14, 2006
Messages
496
Trophies
1
XP
441
Country
Canada
So here's a bit of a map on how the whole cheat thing seems to work.

The GCHEAT_STRUCT just stores the information read from the cheat file. The information used in this struct to activate the cheat is the item_id and sub_active portions of the struct which is used in the call S9xCheat_switch (nds/cheats3.cpp) which operates using Snes9x's internal cheat management. While the cheat file is being read in the load_cheatfile function (nds/gcheat.c), cheats are also being added into Snes9x's own system through this function S9xAddCheat_ex(cheats2.cpp), which adds data to the SCheatData structure (cheats.h) called Cheat (defined in globals.cpp).

So basically, GCHEAT_STRUCT is used as a menu portion to all the cheat data loaded into Snes9x. As far as I can see (without actually downloading the code to search) I couldn't find any use of the SCheat struct. But I never really looked to hard.

Anyhoo, once the cheats are all loaded up, the menu moves some important data over to a struct called game_config in the menu_load_cheat_file function in (nds/gui.c) from the information loaded into the GCHEAT_STRUCT and interacts with that as the menu.


If you need more help on figuring out how its all interconnected, feel free to pm me.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Thanks for the awesome reply, BassAceGold.

I'm trying to move as much of it into the hands of Snes9x as possible. I shall use S9xLoadCheatFile and S9xSaveCheatFile with Snes9x's own file type which I'll call .chb (binary) to avoid confusion, loaded with the gamepak in /CATSFC/gamerts and saved when the user loads a .cht (text) file.

The format I want to use for the .cht would be the one used by older versions of BSNES, available on mightymo's site:

ChtFile : ChtEntry (NEWLINE ChtEntry)* NEWLINE?
ChtEntry : '"' (disabled | enabled) '","' ChtCode '","' Description '"'
ChtCode : (GameGenieCode | ProActionReplayCode | GoldfingerCode) ['+' ChtCode]*
GameGenieCode : As recognised by S9xGameGenieToRaw
ProActionReplayCode : As recognised by S9xProActionReplayToRaw
GoldfingerCode : As recognised by S9xGoldFingerToRaw

If GCHEAT_STRUCT is really just for the menu I might just tie the menu into SCheat.name[n] for each cheat, numbered n, instead of dealing with the duplication in GCHEAT_STRUCT. Then I'll delete GCHEAT_STRUCT.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
1.09 has cheats! Including Game Genie RAM/ROM. I just took the code from Snes9x 1.53's Unix port and adapted it. See the first post for the new download link.

gcheat.c is entirely rewritten, so I took the copyright. It's still under the GPLv2.

Please test, and enjoy!
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
It looks like the audio is causing the FPS to rise and drop at random. Testing with Super Mario World, in Forest of Illusion 3, the FPS was at 4 for most of the level, but after disabling the audio, the FPS was much higher (15+) and much smoother.

Simply disabling the audio in the emulator's settings doesn't help. I had to make S9xGenerateSound and S9xProcessSound, in source/nds/entry.cpp, basically empty functions.

Can anyone shed some light on this?
 

Rydian

Resident Furvert™
Member
Joined
Feb 4, 2010
Messages
27,880
Trophies
0
Age
36
Location
Cave Entrance, Watching Cyan Write Letters
Website
rydian.net
XP
9,111
Country
United States
Educated guess: Disabling the audio in the emulator's settings just mutes it, it doesn't stop the audio emulation from happening.

Yay GG codes! Also yay for (if I'm reading right), the emulator using the old-format BSNES codes... which means my converter pack isn't needed anymore, meaning less work and trouble for everybody involved.
Shut up I'm lazy.


EDIT: BBcode fail fixed.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: It's mostly the ones that are just pictures and no instructions at all