Sonic-CD-11-Decompilation icon indicating copy to clipboard operation
Sonic-CD-11-Decompilation copied to clipboard

macOS: Hi-res mode incorrectly scaled

Open SupakugaiGames opened this issue 3 years ago • 17 comments

In the current state of the decomp (86f916c at the time of writing), the macOS version of RSDKv3 starts up with a blank screen and does nothing. No mod menu, no title screen, no music or sound, no inputs accepted, no anything. The game just doesn't start up correctly. I forked the project and added some debug prints to determine if the engine was even starting up, and from what I can gather, it is. Yet the game just doesn't begin. Running macOS 11.6 on an M1 MacBook Air, and I tested both ARM64 and x86_64 builds. No results. The game crashes as expected if Data.rsdk is not present, but when it is, it just does this: image The settings.ini file is also being overwritten each launch, as mentioned in #124. My RSDK file is fine, as it worked in previous versions of the decomp. So I'm racking my brain here trying to figure out what's going on. Does anyone know what the problem is?

SupakugaiGames avatar Oct 19 '21 10:10 SupakugaiGames

Is a log file generated?

stxticOVFL avatar Oct 20 '21 14:10 stxticOVFL

Because the settings.ini keeps getting overwritten, I edited the code to force a log just now. It didn't write to a file but it wrote in my Xcode window. Here's what I got:

ERROR: Couldn't open file '/Users/Me/Library/Application Support/RSDKv3/settings.ini'! Couldn't load file 'Data/Scripts/ByteCode/GlobalCode.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Scripts/ByteCode/GS000.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/mods/Time Travel Overhaul/Data/Game/GameConfig.bin' 2021-10-20 23:17:24.696605+0700 RSDKv3[48814:12864348] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000008facc0> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2021-10-20 23:17:25.056497+0700 RSDKv3[48814:12864348] Metal API Validation Enabled 2021-10-20 23:17:25.084976+0700 RSDKv3[48814:12864348] +[MTLIOAccelDevice registerDevices]: Zero Metal services found Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Jump.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Ring.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Ring.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Skidding.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/LoseRings.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Hurt.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Charge.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Release.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Destroy.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/LampPost.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/BlueShield.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Spring.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Future.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Past.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/TimeWarp.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/SignPost.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/ScoreAdd.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/ScoreTotal.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/SpecialRing.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/SpecialWarp.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/1Up.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Achievement.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Explosion.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/MenuButton.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Flying.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Tired.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/OuttaHere.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Global/Select.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Palettes/MasterPalette.act' Set Object (0) name to: Blank Object Loading Scene Presentation Stages - TITLE SCREEN Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Palettes/MasterPalette.act' Set Object (0) name to: Blank Object Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/StageConfig.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/StageConfig.bin' Set Object (1) name to: Sega Set Object (2) name to: Sonic Set Object (3) name to: Logo Set Object (4) name to: Background Set Object (5) name to: Clouds Set Object (6) name to: Touch Start Set Object (7) name to: CWLogo Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Scripts/ByteCode/PS000.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/SoundFX/Stage/Sega.wav' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/16x16Tiles.gif' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/16x16Tiles.gif' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/CollisionMasks.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/Backgrounds.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/128x128Tiles.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Stages/Title/Act1.bin' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Sprites/Title/Title.gif' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Sprites/Title/Clouds.gif' Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Sprites/Title/CWLogo.gif'

What it then does is continually print Callback: Display Logos until I quit the program. Nothing appears onscreen.

When I set the default starting scene to 1, it continually loops Loaded File '/Users/Me/Library/Application Support/RSDKv3/Data/Music/JP/SpecialStage.ogg' and doesn't display anything either.

SupakugaiGames avatar Oct 20 '21 16:10 SupakugaiGames

That's really weird. Could you try placing a breakpoint in Reader.cpp:226 once it starts repeating and show the stack trace? I don't use XCode myself (I don't manage Mac development, RDC does,) so sorry if placing breakpoints mid-run is impossible.

stxticOVFL avatar Oct 20 '21 18:10 stxticOVFL

Hopefully I set this up right.

Making the breakpoint in Reader.cpp:226 helped with seeing when it loaded the files. It did not stop at Callback: Display Logos or Loaded File */SpecialStage.ogg in both cases. When I deliberately pause the app during the loop, one of two traces happen: image and image If this doesn't help, where else would you suggest I place a breakpoint?

As well, I decided to place a breakpoint before the error regarding settings.ini not being read, and here's what I got: image Unless pathbuffer is supposed to look like that, I'm wondering if that's the reason settings.ini keeps being overwritten?

SupakugaiGames avatar Oct 21 '21 08:10 SupakugaiGames

pathBuffer should not look like that. This is a great find; I'll forward this issue to RDC.

stxticOVFL avatar Oct 21 '21 13:10 stxticOVFL

I edited ini.cpp:27 to sprintf %s to pathBuffer instead of %s/%s on macOS, which is what it was before. While it allowed loading of the settings.ini file, it still gets overwritten when the game exits normally. As well, the issue of the engine getting stuck in a loop on startup is still there. I'll keep digging around for anything else that might help find a solution to this.

SupakugaiGames avatar Oct 21 '21 13:10 SupakugaiGames

Oh yeah, settings getting overwritten on exit is not a bug. Intentional to ensure any changes while it's running; I'm just glad it's properly loading now. I've sent this issue to RDC, by the way, but when I get home I may be able to investigate it more.

stxticOVFL avatar Oct 21 '21 13:10 stxticOVFL

PROGRESS! image So it turns out my fix before (%s instead of %s/%s) wasn't enough. I had to remove gamePath from the argument, and that made settings.ini actually load. Didn't find that out until I added a debug log call after loading INI files, heh. ~I really don't know what I'm doing, sorry~

The game doesn't boot the normal title screen, still spitting out that constant Callback: Display Logos loop I mentioned before, but now that the game knows DevMenu is true, I can access it and use it normally.

HOWEVER, if I load any scenes, the app freezes again. ...actually, now that I look at it, it's behaving similarly to when I had trouble loading mods on previous versions of RSDKv3 before installing the decompiled scripts. Nothing would work until I went back to the dev menu, just like it is now.

But hey, it's really reading settings.ini now AND not overwriting default values (I checked), so that's something.

SupakugaiGames avatar Oct 21 '21 14:10 SupakugaiGames

I believe that would have to mean that somehow the byte code isn't working properly (because the error also occurs using RSDK as you said), which is at least progress, yeah. Is it still repeating the text in log?

stxticOVFL avatar Oct 21 '21 15:10 stxticOVFL

Correct, the text still repeats. If a scene is selected that starts playing music immediately, it continuously restarts, creating a stutter. Tested with and without scripts, and used both the Steam and iOS 3.0.7 RSDKs. The result has been the same.

SupakugaiGames avatar Oct 21 '21 16:10 SupakugaiGames

When you test with scripts, I'm assuming you enabled the text scripts option in settings.ini to force it on?

stxticOVFL avatar Oct 21 '21 16:10 stxticOVFL

I didn't see a variable for settings.ini to toggle forced scripts, so I enabled it in the code. The game loads the scripts, but I get the same result. Empty screen, looping text in the log.

SupakugaiGames avatar Oct 21 '21 16:10 SupakugaiGames

For future reference, the option is TxtScripts near the top, IIRC. Still, extremely weird that it just is not successfully loading them. I'll ask around in REMS if someone can test on a Mac as well, but for now I don't have any other leads.

stxticOVFL avatar Oct 21 '21 18:10 stxticOVFL

https://github.com/Rubberduckycooly/Sonic-CD-11-Decompilation/issues/133#issuecomment-948658219 Wait, I just realized in this screenshot, it says 1.1.2, but in https://github.com/SupakugaiGames/Sonic-CD-11-Decompilation/commit/86f916cf5361f89ec28eccc665bdeb913e16f922, it says gameVersion is 1.3.0? Are you sure you're using the right commit?

stxticOVFL avatar Oct 22 '21 15:10 stxticOVFL

...I guess not. image I guess the problem got fixed down the line and Xcode never pulled in the right changes (I know for sure it wasn't working when I first forked). I pulled from upstream on Github to make sure I was on the latest commit, redownloaded the project, and boom.

...though this might be worth looking into: image In hi-res mode, the game display doesn't scale up?

SupakugaiGames avatar Oct 22 '21 15:10 SupakugaiGames

Is this in our master (https://github.com/Rubberduckycooly/Sonic-CD-11-Decompilation/commit/cb655c8530ec93ba92271d44bfd97c639c70e3ba), and are you using HW or SW mode?

stxticOVFL avatar Oct 22 '21 18:10 stxticOVFL

This is SW mode. Didn't try yet with HW. I didn't commit any of my changes from Xcode to my fork, so when I redownloaded, it was exactly the same as your master. To be 100% sure, I downloaded your master and compiled it, and it gives me the same result. Prior versions of RSDKv3 don't have this issue, but I don't know which commit last worked.

Edit: Yes, this happens in HW mode too.

Edit 2: This also happens with RSDKv4. Not making a separate issue there since any fixes that apply to v3 could apply to v4 as well.

SupakugaiGames avatar Oct 23 '21 02:10 SupakugaiGames

Should be fixed in 1960ecb

MegAmi24 avatar Jul 31 '23 03:07 MegAmi24