Hype: The Time Quest Widescreen

Discuss tools to aid in the modification and running of Rayman games.

Moderator: Modding and utilities team

Forum rules
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Hype: The Time Quest Widescreen

Post by PluMGMK »

Garo wrote: Mon Jun 20, 2022 7:44 pm
AlphaYellow wrote: Mon Jun 20, 2022 5:19 pm It didn't work, it's an engine framerate cap. Maybe someone in the future will figure out how to disable it in the EXE code or something like that to unlock the weird 48 fps cap, it's beyond me why a dev would ever cap a game that framerate.
They probably capped the framerate to 48 FPS because at the time PC's would probably never reach that frame rate. It's still an odd choice though.
I doubt it, 60 fps should at least have been an aspiration, even if not necessarily practical in all cases. Feels more like a snafu along the lines of this one
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Hello everyone. I've got some news about the widescreen fix:

Thanks to the raymap source code (which is able to decode Hype's sna-format) I now understand enough about the SNA-format to be able to change the FOV in there :D Here's how the headers of each block in the SNA-file look:
hype_sna_structure.png
The file starts with a block of size 0 with only the header (yellow). The next block has a header (green), and since its size is >0, it has a sub-header (blue) with information about the compression, followed by the actual compressed block (white).
It turns out, that the block is compressed with the lzo1x algorithm. I have written a little script (in python - because it's the only programming language i know) that decompresses each of the blocks, changes the isCompressed part of the sub-header from 1 to 0 and replaces the compressedSize with the decompressedSize (it also replaces compressedChecksum with decompressedChecksum, but that is not necessary). In the end, we get a decompressed version of the SNA-file that will actually work with the game just like the original file :) Note that if you want to make any changes to the decompressed block, you have to adjust the decompressedChecksum accordingly (which is adler32 btw.). I never tried altering the size of the decompressed block (it's not necessary for changing the FOV) and I'm not sure if it breaks anything in terms of memory allocation (maybe the actual header - not just the sub-header - has to be changed as well).

Anyway.. I have attached the python script. Feel free to try it out (note that it requires the python-lzo module).

Next thing, I'll write a little tool (probably also in python) to be able to change the FOV in fix.sna and other SNA-files to fix the bug, where the FOV changes after using one of the sun-dials. This will also make the original modifications to MaiDFXvr_bleu.exe less "hacky" :lol:

Fun fact: remember how I spend ages debugging the game trying to figure out, why the FOV changes after using the sundials? In the end, I found out that using the sundials changes the FOV from 1.6 to 3 in steps of 0.3 and then back from 3 to 1.6 in steps of 0.08. Once you know this, you can easily find this information in Raymap (see screenshots)
raymap_foc_change1.png
raymap_foc_change1.png (8.41 KiB) Viewed 4187 times
raymap_foc_change2.png
Attachments
decompress.7z
(1.09 KiB) Downloaded 138 times
deton24
Art Rytus
Posts: 1194
Joined: Fri Jan 14, 2011 1:22 am
Location: Poland
Tings: 8932

Re: Hype: The Time Quest Widescreen

Post by deton24 »

Why is everybody so ashamed of using Python? Look what it can still achieve... OK, maybe it's slow.
But they say - what's the best microphone in the world? - The one you just have to make a great use of it.
Great work. Though I know absolutely sh* about most you've written, but I admire it AF as all the work Droolie and company does. Have a nice day.
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Hype: The Time Quest Widescreen

Post by PluMGMK »

Nice one! :D
deton24 wrote: Wed Jul 20, 2022 4:38 pm Why is everybody so ashamed of using Python? Look what it can still achieve... OK, maybe it's slow.
Yeah, I was going to ask the same question… Python's a damn good language*, and for once-off scripts like this one speed shouldn't matter anyway.

* I admit I didn't always feel this way XD
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Haha, I love Python, too. But it does sometimes feel like you have to apologize everytime you use it :lol:

My plan is to make the next version of the widescreen fix a patcher-script that will take the original .exe (and the relevant .sna files) and does a simple search and replace. With any luck, this will work with BOTH the English/German and the Spanish .exe (and maybe even other localized versions that I haven't heard of). Because the python-lzo module is a bit harder to use and not everyone has Python installed, I will probably pack the patch into a single exe-file using PyInstaller ;)

Maybe, after that, I will also look into fixing the 48 FPS limit... but I have no idea if this is even feasible. I guess if it's fixable in Rayman 2, it should be fixable in Hype... at least in theory.
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Hype: The Time Quest Widescreen

Post by PluMGMK »

I'm more inclined to apologize for using C/C++, because I never really learned to write them properly :hap:

The 48 FPS thing definitely sounds fixable, but I guess it's hard to predict how much work it would take. If it's a stupid mistake like the Rayman 3 1.2× thing, then it could be a very simple fix indeed!

EDIT: What do you know, today's Daily WTF deals with a combination of Python and C++ :hap:
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Hello everyone,

as promised earlier - here's a new version of the Hype widescreen fix. It now uses a patcher that works with a simple "search-and-replace" algorithm. I tested it with both the English and Spanish game EXE, but it should hopefully also work with other localized versions ;)

Here's whats new:
  • New patcher, which should work independent of the game's localization
  • You can choose to use either nGlide (use with Vulkan!) or dgVoodoo (D3D)
  • New instructions on how to set up nGlide or dgVoodoo included in the Readme
  • Refactored the code changes to the game's binary. It is now less "hacky" (less jumping around in the code)
  • New patcher to change the game's FOV in the SNA files (this also fixes the "wrong-FOV-after-time-travelling" bug that was alerady present in the original game)
The patcher was originally written as a Python script, but I converted it to an executable using PyInstaller for ease of use. In case you would like to use the original Python script instead, I also included the source code (note that the FOV-changer requires the python-lzo module).

Important Note: I had to split the file, because I can only attach 3MB per file in this forum. Also I could not attach files ending in "7z.001" or "7z.002. Therefore you need to rename HypeWidescreenV4_1.7z -> HypeWidescreenV4.7z.001 and HypeWidescreenV4_2.7z -> HypeWidescreenV4.7z.002 in order to unzip them. Sorry for the inconveniences ;)
Attachments
HypeWidescreenV4_1.7z
Rename to HypeWidescreenV4.7z.001
(2.73 MiB) Downloaded 156 times
HypeWidescreenV4_2.7z
Rename to HypeWidescreenV4.7z.002
(2.41 MiB) Downloaded 153 times
deton24
Art Rytus
Posts: 1194
Joined: Fri Jan 14, 2011 1:22 am
Location: Poland
Tings: 8932

Re: Hype: The Time Quest Widescreen

Post by deton24 »

Thank you!

Clever idea for a mirror.
Anyway, if someone is too lazy, here is a single archive.
https://disk.yandex.com/d/wwKMTL3otGsxfQ

BTW. You accidentally made me realize that dgVoodoo has DX12 support since September 2020 and v. 2.7...
AlphaYellow
Super Yellow Lum
Posts: 36
Joined: Tue Aug 17, 2021 12:42 am
Contact:
Tings: 180

Re: Hype: The Time Quest Widescreen

Post by AlphaYellow »

Hi lk19, uploaded your Widescreen/FOV Patch to PCGamingWiki. Thanks a lot to your efforts! Here are some screenshots:

MaiDFXvr_bleu 2022-08-13 09-05-21-713.png
MaiDFXvr_bleu 2022-08-13 06-32-32-776.png
MaiDFXvr_bleu 2022-08-13 06-31-34-343.png
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Good News! I figured out how to disable the 50 FPS-limit :) It's easy to do, so I'll describe how to hex-edit the .exe file below. I haven't really tested it a lot, but if it works well enough for everyone, I might include it in the widescreen-patcher.

After some tedious debugging, I finally managed to find the place where the maximum number of frames per seconds is stored. If you know what you're looking for, it's ridiculously easy to find :lol: It's literally next to a string that says "%d fps" (not kidding!) :facepalm:

The game tries to limit the FPS to 50, but due to the way the timing works, it turns out a little lower than that (I get an almost constant 48 FPS most of the time). So if you'd like to get a stable refresh rate of 60 FPS, you need to set it a little higher (e.g. 65 FPS).

Note that you cannot go higher than 60 FPS with this method, as the game initializes GLIDE with 60 frames (this is why we always get 60 FPS in the menus). If you want to go REALLY crazy, you could also disable this internal 60 FPS limit. I'll provide the instructions below. But from what I can tell, the game starts to feel weirdly sped-up if you go too high. Also, completely disabling the frame limit makes the main menu hard to navigate!

Here's what to do:

Max. 60 FPS:
Open MaiDFXvr_bleu.exe in a hex-editor (it doesn't matter if you already applied the widescreen fix or not) and look for the sequence "32 00 00 00 25 64 20 20 66 70 73 00" Replace the "32" at the start with your desired framerate (in hex). 60 FPS would be "3C" in hex, but you should probably go a little higher to get a stable framerate, e.g. "41", which is 65 FPS in hex.

More than 60 FPS (VERY EXPERIMENTAL) :
Follow the previous instructions and choose a value larger than 60 FPS. In addition to that search for the byte sequence "8b 48 38 83 c4 04 85 c9 74 0c". It should be followed by "e8 XX XX XX XX 6a 01" (the XX might be different depending on your localization - for the English .exe it's "4e 7e 14 00"). Replace the last "01" by "00" to completely disable the frame limit in the game's menus. In the actual game, the refresh rate will be whatever value you chose in the previous step.
deton24
Art Rytus
Posts: 1194
Joined: Fri Jan 14, 2011 1:22 am
Location: Poland
Tings: 8932

Re: Hype: The Time Quest Widescreen

Post by deton24 »

If anyone asks, Bug Error/tCA no-CD binary doesn't have 32 00 00 00 25 64 20 20 66 70 73 00 value, but two of 32 00 00 00.
The first is right at the beginning of the file, the second is a an ending of the string grGet@12...
No one will ban you if you upload the binary here. We're the law here memberlist.php?mode=group&g=428 with dr_st :)

BTW. Rayman 2 with Glide renderer runs at max 63 FPS.
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

deton24 wrote: Tue Aug 16, 2022 10:58 pm If anyone asks, Bug Error/tCA no-CD binary doesn't have 32 00 00 00 25 64 20 20 66 70 73 00 value, but two of 32 00 00 00.
The first is right at the beginning of the file, the second is a an ending of the string grGet@12...
I've had a quick look at the binary you mention, and it looks like it doesn't contain any of the relevant code for the widescreen fix either (hence the patcher won't work with it). Maybe this no-CD-patched file still has some kind of encryption to it or still requires the .icd file in order to work.
The game uses SafeDisc copy protection. The original MaiDFXvr_bleu.exe only contains the copy protection and the actual binary is encrypted in the .icd file. There are tools available to remove the SafeDisc DRM (which is absolutely necessary nowadays, since SafeDisc does NOT work on Windows 10 anymore). They decrypt the .icd file and put all the relevant code into a single .exe. Most no-CD patched binaries I have found (e.g. https://www.zeus-software.com/files/ngl ... _patch.zip) are like this. The tCA version you mention seems to be different. It also doesn't like to be analyzed with Ghidra.
deton24 wrote: Tue Aug 16, 2022 10:58 pm BTW. Rayman 2 with Glide renderer runs at max 63 FPS.
The same goes for Hype, unless you use the second (experimental) hack. Here's why:
There are two separate FPS limits in the code. The actual (i.e. when not in the menus) framrate is limitied by whichever limit is lower!
The "in-game" frame limit (does not affect FPS in the menus):
This is the value in front of the "%d fps" string. Its vanilla value is 50 (resulting in ~48FPS). Changing this to anything above ~65-70 does not yield a higher framerate unless you change the other limit, too.
The GLIDE frame limit:
GLIDE is initialized using the function grSstWinOpen(GR_RESOLUTION=0x7 [=640x480], GR_REFRESH=0x0 [=60Hz], ...other parameters...). The possible values for GR_RESOLUTION and GR_REFRESH can be found here: https://github.com/RetroAchievements/RA ... /sst1vid.h . Not all possible values seem to work (some crash the game), but changing GR_REFRESH seems to be one way of changing the GLIDE framerate. Another method to COMPLETELY disable the GLIDE framerate limit is to look for the function call grBufferSwap(1). Changing this to grBufferSwap(0) disables the GLIDE framerate limit. This is the experimental hack that I mentioned earlier.
Rayman 2 uses Glide2x (whereas Hype usese Glide3x), but the two functions I mentioned here should be the same for both versions of the API. So I guess it should not be a problem to also disable the GLIDE FPS-limit in Rayman (although I'm not sure it's a good idea).
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Hype: The Time Quest Widescreen

Post by PluMGMK »

Well done, I knew you'd find a solution eventually! :)

So the limit was intended to be 50 fps. That makes a lot more sense than 48, since 50 is an actual refresh rate that was used at the time (e.g. on PAL consoles I guess)
Thunder5torM
Red Lum
Posts: 11
Joined: Tue Aug 23, 2022 9:51 am
Tings: 55

Re: Hype: The Time Quest Widescreen

Post by Thunder5torM »

Hi all guys i'm very interested to this game and to this fix :) I've downloaded the lk19 Hype Widescreen V4 fix, but doubleclicking on it I recive an error message: api-ms-win-core-path-l1-1-0.dll not found :| Downloaded that dll file but nothing. How to solve? Thanks!
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Thunder5torM wrote: Tue Aug 23, 2022 9:59 am Hi all guys i'm very interested to this game and to this fix :) I've downloaded the lk19 Hype Widescreen V4 fix, but doubleclicking on it I recive an error message: api-ms-win-core-path-l1-1-0.dll not found :| Downloaded that dll file but nothing. How to solve? Thanks!
You are probably using Windows 7 (or earlier). The problem is that I "built" the .exe with Python 3.10, which does not support Windows 7 anymore. I haven't tried it out myself, but you might want to have a look at https://github.com/nalexandru/api-ms-wi ... path-HACK/.
Thunder5torM
Red Lum
Posts: 11
Joined: Tue Aug 23, 2022 9:51 am
Tings: 55

Re: Hype: The Time Quest Widescreen

Post by Thunder5torM »

Hi lk19 and thanks for your reply. Yes, i have Win7, but yesterday i've also tried the patch in another pc with Win10: no dll error, but the cmd winow appear for a second, then nothing. Anyway i've tried now with this other dll on my WIn7. The cmd terminal winow says: "the following arguments are required: path_to_exe". Suggestions?
lk19
Incrediball
Posts: 72
Joined: Thu Feb 11, 2021 8:52 pm
Tings: 360

Re: Hype: The Time Quest Widescreen

Post by lk19 »

Thunder5torM wrote: Tue Aug 23, 2022 9:21 pm "the following arguments are required: path_to_exe"
That looks like it's actually working with the dll-hack :) You need to pass the path to MaiDFXvr_bleu.exe as a command line argument. E.g. from cmd you run "widescreen_fix.exe C:\Games\Hype\MaiDFXvr_bleu.exe" (or wherever you installed the game).
Thunder5torM
Red Lum
Posts: 11
Joined: Tue Aug 23, 2022 9:51 am
Tings: 55

Re: Hype: The Time Quest Widescreen

Post by Thunder5torM »

Hi lk19, the CMD screen appear, but disappear in less than a second, so your exe doesn't start :(
If is not a problem can you send here or in my PM the two game exes already 16:9 patched for 1920X1080 reoslution?
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Hype: The Time Quest Widescreen

Post by PluMGMK »

You can drag-drop the game exe onto the wide-screen fix exe.
Thunder5torM
Red Lum
Posts: 11
Joined: Tue Aug 23, 2022 9:51 am
Tings: 55

Re: Hype: The Time Quest Widescreen

Post by Thunder5torM »

Thanks PluMGMK. Works! :)
Post Reply