Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a better flashlight #7

Closed
4 tasks
Polymega opened this issue Jun 8, 2018 · 25 comments
Closed
4 tasks

Building a better flashlight #7

Polymega opened this issue Jun 8, 2018 · 25 comments

Comments

@Polymega
Copy link
Collaborator

Polymega commented Jun 8, 2018

Edit: I did my final edits to this ReShade filter tonight. I changed the flashlight intensity value from 2.400000095 to 2.200000048.


@AeroWidescreen @Bigmanjapan

With how much work and testing has been done and continues to be done to fix the flashlight I felt it would be best to dedicate a thread just for the topic at hand. Specifically because this thread is about shadow castings which is unrelated to the flashlight illumination issues.

So what are the four main goals in fixing the flashlight? Well, three you already know about and I'd like to introduce a fourth goal:

Why am I suggesting dimming the flashlight? Please see here:
http://enhanced.townofsilenthill.com/SH2/comparisons/flashlight.htm

What you are seeing there is four images:

  1. SH2 PC default screenshot
  2. SH2 PC screenshot with my ReShade "PS2" filter
  3. SH2 PC screenshot with my ReShade "PS2" filter and adjusted flashlight settings
  4. SH2 PS2 screenshot

What I have been doing the past several days is making a "PS2" filter for ReShade. The goal is to simply apply this filter for the most PS2-like visuals on the PC version. I've been tinkering and fine-tuning the settings as best as possible. I could get the filter to look so close to the PS2 version in regards to gamma, contrast, and overall levels except for areas that involve the flashlight.

After a bit of confusion I finally realized: It's because the PC version's flashlight is overall brighter than the PS2 builds.

So using Cheat Engine I changed the following:

Description Address Original Value New Value
Flashlight Intensity R 00942AB0 (float) 7 2.200000048
Flashlight Intensity G 00942AB4 (float) 7 2.200000048
Flashlight Intensity B 00942AB8 (float) 7 2.200000048
Light Reach 00942AE8 (float) 6000 5750

And that is the results you see in the link above.

Now, the big question is: Is it worth changing the flashlight levels for a more PS2-like experience? After playing around some with these new levels, I kind of think so. Even when the "PS2" filter is off, and you're playing the game with the default visuals, the adjusted flashlight levels still look more "right," in my opinion. Additionally, maybe it could make fixing the other two flashlight bugs easier? (The backlighting and dynamic objects going to full brightness first.)

I'd suggest you guys try these settings out for yourself and tell me what you think? And remember: If you used these adjusted light settings in conjunction with the PS2 filter I'm making it'd look that much better.

But changing these settings comes with odd visual bugs. When you turn the light on it goes to full brightness (float 7) before jumping back down to 2.200000048 (also note that values 4-7 don't change the light levels... after 4 it stays at max brightness). Also, when entering a new room the flashlight will very quickly flicker from brightness 7 back down to 2.200000048. And naturally--and unsurprisingly--enemies/dynamic objects still glow to a higher brightness before dimming back down.

Also, I have not done a full play test with these changes in effect yet so it may crash the game; I'm not sure.

What's your thoughts, gentlemen?

@Polymega
Copy link
Collaborator Author

Polymega commented Jun 8, 2018

Something interesting I just noticed: When you decrease the flashlight's intensity on the PC version the dynamic objects also become darker. But we don't want this. On the PS2 version, the flashlight is dimmer but the dynamic objects are the same brightness as the default PC version.

I believe the PC version has addresses that control the dynamic object's illuminations separately from the flashlight?

See examples below:


PC version (default flashlight)

Notice how bright the walls are (too bright) but also notice how bright the enemy is:

sh2pc 2018-06-07 23-40-37


PC version (adjusted flashlight)

The walls are at the same/correct level as the PS2 build now but the dynamic object (enemy) has become way too dark:

sh2pc 2018-06-07 23-40-44


PS2 version

Notice how the walls in our PC adjusted flashlight screenshot are the same as in this PS2 screenshot below. However, the enemy in this PS2 shot is the same brightness as the default PC flashlight levels (first image):

image

@Polymega
Copy link
Collaborator Author

Polymega commented Jun 9, 2018

Some testing updates. The big take-away here is that changing Bigmanjapan's luminescence fix addresses to 0 instead of 2-6 makes the fix work if you also adjust flashlight levels:


Description Address Original Value New Value
Flashlight Intensity R 00942AB0 (float) 7 2.200000048
Flashlight Intensity G 00942AB4 (float) 7 2.200000048
Flashlight Intensity B 00942AB8 (float) 7 2.200000048
Flashlight Reach 00942AE8 (float) 6000 5750
Room 205 Luminescence Fix R 007F72F0 (float) 7 2-6
Room 205 Luminescence Fix G 007F72F4 (float) 7 2-6
Room 205 Luminescence Fix B 007F72F8 (float) 7 2-6

✔️ Flashlight is at PS2 brightness levels and reach for environments
❌ Dynamic objects are too dark
❌ Dynamic objects do not smoothly fade when leaving flashlight's reach
❌ Dynamic objects and the flashlight temporarily glow to full brightness before dimming back down
❌ Turning on the flashlight/entering rooms quickly flashes the light's brightness back to 7
The Room 205 luminescence fix does not work
✔️ The game does not crash when flashlight dies in the cockroach room
James "glows" in certain spots in the Alternate Hotel


Description Address Original Value New Value Newer Value
Flashlight Intensity R 00942AB0 (float) 7 2.200000048
Flashlight Intensity G 00942AB4 (float) 7 2.200000048
Flashlight Intensity B 00942AB8 (float) 7 2.200000048
Flashlight Reach 00942AE8 (float) 6000 5750 5750
Room 205 Luminescence Fix R 007F72F0 (float) 7 2-6 0
Room 205 Luminescence Fix G 007F72F4 (float) 7 2-6 0
Room 205 Luminescence Fix B 007F72F8 (float) 7 2-6 0
Aero's flashlight addresses 0050AAC6 (float) 7 2.200000048
Aero's flashlight addresses 0050A256 (float) 7 2.200000048

✔️ Flashlight is at PS2 brightness levels and reach for environments
❌ Dynamic objects are too dark
❌ Dynamic objects do not smoothly fade when leaving flashlight's reach
✔️ Dynamic objects and the flashlight do not temporarily glow to full brightness before dimming back down
✔️ Turning on the flashlight/entering rooms quickly does not flash the light's brightness back to 7
✔️ The Room 205 luminescence fix does work
✔️ The game does not crash when flashlight dies in the cockroach room
James "glows" in certain spots in the Alternate Hotel


Thoughts

  • Similar to how Bigmanjapan found special addresses to fix the luminescence of dynamic objects in Room 205 I wonder if there are special address in the areas where James glows in the Alternate Hotel to make him un-glow?

  • Refering to my post above (comparing PC to PS2 lighting for environments and dynamic objects) there is definitely a set of addresses that further affect how much dynamic objects glow... in addition to the flashlight's overall strength. This is more-or-less confirmed based on this PS2 shot; the Lying Figure is at full brightness but the walls are dimmer:

image

  • Additionally, I can't help but to wonder if dynamic objects have their own "light reach." We can adjust the reach of the actual flashlight but do you think there is a float value that also determines how far a dynamic object can be before the flashlight no longer has an effect on it? In otherwords: Instead of changing the flashlight reach to fix the dynamic object's fade-out distance I wonder if there's a value for the dynamic object's fade-out distance to change to conform to the flashlight's instead?

@Bigmanjapan
Copy link

Bigmanjapan commented Jun 9, 2018

Setting intensity to 2.200000048 makes the flashlight work on 2nd preset. I guess it's fine if it does the job.

Easy way to fix hotel issues would be to revert all the addresses back to default values upon James watching the tape cutscene. It seems that once the flashlight is gone some light sources take those addresses for themselves.

there is definitely a set of addresses that further affect how much dynamic objects glow...

sh2pc.exe+542B50 (00942B50) float
Since James' model is also a dynamic object, it's brightness also go up.

I don't post much for now because the flashlight system is extremely complex and it takes time to understand it and not just poke blindly.

Edit:

These three seem to control brightness of dynamic objects excluding James model. NOPing functions on this addresses make flashlight turning on effect stuttering, so they should be manipulated in other way. Also should take into consideration that every change that is made to dynamic objects brightness will affect cube room location. So there might be a need to make an exception function to control cube room brightness.

sh2pc.exe+1B7D65C (01F7D65C) float R
sh2pc.exe+1B7D660 (01F7D660) float G
sh2pc.exe+1B7D664 (01F7D664) float B

https://youtu.be/-L-XOdTI9PQ

These control intensity of the dark part of the flashlight spread.

sh2pc.exe+542A60 (00942A60) float
sh2pc.exe+542A64 (00942A64) float
sh2pc.exe+542A68 (00942A68) float

default

Some common brightness? 00942C3C float

Edit:

Might be wise to use these addresses for Flashlight Reach, they don't reset upon transition. Similar to my and Aero's flashlight intensity addresses.

sh2pc.exe+3F7A88 (007F7A88) float - controls light reach in every rooom besides mannequin room?
sh2pc.exe+3F72C8 (007F7AC8) float - controls light reach in mannequin room

Edit:

Not sure thre is a need to decrease light reach value? It's a direct reason for "Dynamic objects do not smoothly fade when leaving flashlight's reach" issue.

@Polymega
Copy link
Collaborator Author

Polymega commented Jun 9, 2018

Easy way to fix hotel issues would be to revert all the addresses back to default values upon James watching the tape cutscene. It seems that once the flashlight is gone some light sources take those addresses for themselves.

The only concern here is: What if someone loads a save file after the hotel tape cutscene?

sh2pc.exe+542B50 (00942B50) float
Since James' model is also a dynamic object, it's brightness also go up.

These are good ideas! And I apologize: I used the wrong word previously. I should not have said they need to "glow." Instead, they need to have areas where light touches them to be brighter (while the flashlight overall remains dimmer).

Here's what it looks like when I increase 00942B50:

image

^ While the mannequin is back at the right level all the dynamic objects' shadows no longer have an influence on themselves. (This would happen in the multiple rooms I tested.) So this is something we would not want to do...


These three seem to control brightness of dynamic objects excluding James model. NOPing functions on this addresses make flashlight turning on effect stuttering, so they should be manipulated in other way.

sh2pc.exe+1B7D65C (01F7D65C) float R
sh2pc.exe+1B7D660 (01F7D660) float G
sh2pc.exe+1B7D664 (01F7D664) float B

Nice! I know you want to find another solution due to the flashlight stuttering but this seems to fix the dynamic objects' levels without touching our dimmed down flashlight levels. So that's a step in the right direction! I set these values to "7" (a value of "1.2" is better) for this test:

image

...except for James who still seems to be dimmed by the reduced flashlight levels:

image

...and there is automatic flashlight stuttering in Room 205:
https://youtu.be/9f4JBYFXMR4


Also should take into consideration that every change that is made to dynamic objects brightness will affect cube room location.

Personally, if we can make the flashlight work and look good for all other areas of the game then I don't think people would mind much if the just cube room goes back to vertex lighting.


Not sure thre is a need to decrease light reach value? It's a direct reason for "Dynamic objects do not smoothly fade when leaving flashlight's reach" issue.

I adjusted the flashlight reach levels to make it more similar to the PS2 version. There may be another way to achieve this? It depends on how "true to the source" we want to make it.


Lastly, from your video here Bigmanjapan I was able to re-create the PS2 noise grain filter nearly perfect. Here is what I changed:

Description Address Original Value New Value
Noise filter opacity 00942CC5 (byte) 222 30
Noise filter preset 00942CC0 (byte) 0 0
Noise filter size 00942CC2 (byte) 96 0

Here is a comparison:
http://enhanced.townofsilenthill.com/SH2/comparisons/noisefilter.htm

@Polymega
Copy link
Collaborator Author

Polymega commented Jun 10, 2018

Notes for posterity:

I know we aim to not use these addresses but I'd like to mention they negatively affect the water.
Something to be mindful of and test down the line even if we change other values for the flashlight.

Description Address
Flashlight Intensity R 00942AB0 (float)
Flashlight Intensity G 00942AB4 (float)
Flashlight Intensity B 00942AB8 (float)

001
002
00

@Polymega
Copy link
Collaborator Author

Polymega commented Jun 12, 2018

A little more experimentation. I have not done a full play through with these settings:

Description Address Original Value New Value
Flashlight Reach 00942AE8 (float) 6000 8500
Room 205 Luminescence Fix R 007F72F0 (float) 7 0
Room 205 Luminescence Fix G 007F72F4 (float) 7 0
Room 205 Luminescence Fix B 007F72F8 (float) 7 0
Aero's flashlight address* 0050AAC6 (float) 7 2.200000048
Aero's flashlight address* 0050A256 (float) 7 2.200000048
Bigmanjapan's dynamic object address R** 01F7D65C (float) 0.5500000119 1.2
Bigmanjapan's dynamic object address G** 01F7D660 (float) 0.5500000119 1.2
Bigmanjapan's dynamic object address B** 01F7D664 (float) 0.5500000119 1.2

* Game must be re-loaded for changes to take effect.
** For now, these addresses need to be "NOP'ed" to see changes take effect.

  • ✔️ Fixes backlighting bug (0050AAC6, 0050A256)
  • ✔️ Flashlight is at PS2 brightness levels for environments (0050AAC6, 0050A256)
  • ✔️ Dynamic objects and the flashlight do not temporarily glow to full brightness before dimming back down when you turn the light on (0050AAC6, 0050A256)
  • ✔️ Turning on the flashlight/entering rooms quickly does not temporarily flash the light's brightness back to 7 (0050AAC6, 0050A256)
  • ❌ The flashlight's light "stutters" on dynamic objects as it turns on (01F7D65C, 01F7D660, 01F7D664)
    • A result of stopping/NOP'ing the functions
  • ✔️ Dynamic objects do smoothly fade when leaving flashlight's reach (00942AE8)
  • ✔️ Dynamic objects are the correct brightness when the flashlight is on (01F7D65C, 01F7D660, 01F7D664)
  • ❌ James is not the correct brightness when the flashlight is on (0050AAC6, 0050A256)
    • Note: Just how 01F7D65C, 01F7D660, 01F7D664 control brightness for dynamic objects when flashlight is on maybe there's another address to do the same just for James?
  • ✔️ The Room 205 luminescence fix does work for dynamic objects (007F72F0, 007F72F4, 007F72F8)
  • James "flickers" in Room 205 before acquiring the flashlight (0050AAC6, 0050A256)
    • Similar to the issue mentioned above?
  • ✔️ The water lighting levels are correct (0050AAC6, 0050A256)
  • ✔️ The game does not crash when flashlight dies in the cockroach room (0050AAC6, 0050A256)
  • James "glows" in two spots in the Alternate Hotel (0050AAC6, 0050A256)
    • Most likely because, since flashlight is no longer used at this point, the addresses are released and used for other purposes.

Notes:
As mentioned by Bigmanjapan, increasing flashlight reach fixes the issue of dynamic objects not smoothly fading out of flashlight's reach. This obviously slightly increased how far out the flashlight can illuminate things making it slightly different that PS2 version but it's a good compromise vs. having dynamic objects simply "pop" and vanish out of distance.

@AeroWidescreen
Copy link
Collaborator

AeroWidescreen commented Jan 14, 2019

@elishacloud

I suggest doing this one section at a time. Let me know if you have any trouble with it. Ask @Polymega what this feature should be called if you're not sure what to name it.


Please look at line 00000002 of the code below. If this is not possible, then you could try excluding all values that aren't 7.0 float instead. Replace push eax, lea eax,[esi], and cmp eax,00942AB0, with cmp [esi],40E00000. Then delete the two pop eax.

// Flashlight Brightness

0047A53E jmp 00000000
00000000 push eax
00000001 lea eax,[esi]
00000002 cmp eax,00942AB0 // the address we're excluding here will be different for other executables
00000003 jne 00000017

00000004 pop eax
00000005 mov [BRIGHTNESS_1],3F99999A // flashlight brightness; 1.2 float
00000006 fmul dword ptr [BRIGHTNESS_1] 
00000007 fstp dword ptr [esp+04]
00000008 fld dword ptr [esi+04]
00000009 fmul dword ptr [BRIGHTNESS_1]
00000010 fstp dword ptr [esp+08]
00000011 fld dword ptr [esi+08]
00000012 fmul dword ptr [BRIGHTNESS_1]
00000013 fstp dword ptr [esp+0C]
00000014 fld dword ptr [esi+0C]
00000015 fmul dword ptr [BRIGHTNESS_1]
00000016 jmp 0047A56B

00000017 pop eax
00000018 mov [BRIGHTNESS_2],40800000 // environment brightness; 4.0 float
00000019 fmul dword ptr [BRIGHTNESS_2]
00000020 fstp dword ptr [esp+04]
00000021 fld dword ptr [esi+04]
00000022 fmul dword ptr [BRIGHTNESS_2]
00000023 fstp dword ptr [esp+08]
00000024 fld dword ptr [esi+08]
00000025 fmul dword ptr [BRIGHTNESS_2]
00000026 fstp dword ptr [esp+0C]
00000027 fld dword ptr [esi+0C]
00000028 fmul dword ptr [BRIGHTNESS_2]
00000029 jmp 0047A56B


This reduces the brightness of movable objects for specific rooms so that they no longer appear to glow.

// Woodside Apartment Room 205

007F72F0 00000000 // Movable Object Brightness (Red); 0
007F72F0 00000000 // Movable Object Brightness (Green); 0
007F72F0 00000000 // Movable Object Brightness (Blue); 0

// Otherworld Hotel Kitchen

007FEB10 00000000 // Movable Object Brightness (Red); 0
007FEB14 00000000 // Movable Object Brightness (Green); 0
007FEB18 00000000 // Movable Object Brightness (Blue); 0

// Otherworld Hotel Stairwell

007FEB10 C1C80000 // Movable Object Brightness (Red); -25.0
007FEB14 C1C80000 // Movable Object Brightness (Green); 25.0
007FEB18 c1C80000 // Movable Object Brightness (Blue); -25.0

Changing the preset value solves a few issues, like the old double-sided flashlight bug and brightness inaccuracies.

// Movable Object Preset Part 1

004FF1E0 jmp 00000000
00000001 cmp [01F7A7C4],0000004E
00000002 je 00000011 // jumps if Laura drawing in hotel cutscene
00000003 cmp [01F7A7C4],00000019
00000004 je 00000013 // jumps if bowling Eddie and Laura cutscene
00000005 cmp [01FB7DAC],000000B7
00000006 je 00000013 // jumps if Otherworld Hotel Kitchen
00000007 cmp [01FB7DAC],000000AB
00000008 je 00000013 // jumps if Otherworld Hotel Stairwell

// for everything else
00000009 mov [01F7D714],00000003 // movable object preset
00000010 jmp 004FF1EA

// for Laura drawing in hotel cutscene
00000011 mov [01F7D714],00000002 // movable object preset
00000012 jmp 004FF1EA

// for Otherworld Hotel & bowling Eddie and Laura cutscene
00000013 mov [01F7D714],00000004 // movable object preset
00000014 jmp 004FF1EA

Same exact code as above, just different memory location for the jmp.

// Movable Object Preset Part 2

00502BB0 jmp 00000000
00000001 cmp [01F7A7C4],0000004E
00000002 je 00000011 // jumps if Laura drawing in hotel cutscene
00000003 cmp [01F7A7C4],00000019
00000004 je 00000013 // jumps if bowling Eddie and Laura cutscene
00000005 cmp [01FB7DAC],000000B7
00000006 je 00000013 // jumps if Otherworld Hotel Kitchen
00000007 cmp [01FB7DAC],000000AB
00000008 je 00000013 // jumps if Otherworld Hotel Stairwell

// for everything else
00000009 mov [01F7D714],00000003 // movable object preset
00000010 jmp 00502BBA

// for Laura drawing in hotel cutscene
00000011 mov [01F7D714],00000002 // movable object preset
00000012 jmp 00502BBA

// for Otherworld Hotel & bowling Eddie and Laura cutscene
00000013 mov [01F7D714],00000004 // movable object preset
00000014 jmp 00502BBA

Extends the distance of the flashlight so that NPCs don't suddenly become dark.

// Flashlight Reach

0047B9B4 jmp 00000000
00000000 cmp ecx,45BB8000
00000001 jne 00000003 // jumps if value is not 6000 flt
00000002 mov ecx,4604D000 // flashlight reach; 8500 flt
00000003 mov [00942AE8],ecx
00000004 jmp 0047B9BA

Increases the maximum flashlight brightness of movable objects. This ensures a completely smooth transition when turning on the flashlight.

// Maximum Movable Object Brightness

004FF1F0 fmul dword ptr [address] // value of address used here = 0.7 float (3F333333)
00502BC0 fmul dword ptr [address] // value of address used here = 0.7 float (3F333333)

@Polymega
Copy link
Collaborator Author

Ask @Polymega what this feature should be called if you're not sure what to name it.

Maybe:
PS2FlashlightBrightness = 1 // Adjusts flashlight's brightness to resemble the PS2 version. Reduces flashlight's intensity for environments, but keeps enemies and NPCs bright.

@AeroWidescreen I'm really proud of what you've accomplished here. This fix is a beast, to say the least. The flashlight is such a pivotal tool in the game that will naturally affect so many things (read: memory addresses), that this was no walk in the park to implement--and to implement as well as you did.

This was an off-and-on again project that took months to perfect, as the flashlight adjustments could change other things that one might not readily expect. I hope that anyone else reading this will really appreciate the time and talent Aero_ put into this, just the same as what all other team members do for all sorts of other fixes for the game.

Throughout the many iterations your fix went through, I'm honored to have play tested them all, and to see your work and approach grow was a bit inspirational. Thank you once again for lending your talents in improving such a damn important part of the overall experience to this game.

@elishacloud
Copy link
Owner

Thank @AeroWidescreen! I will work on these ASM functions once I finish the one here.

@elishacloud
Copy link
Owner

@AeroWidescreen, are the "Otherworld Hotel Kitchen" and the "Otherworld Hotel Stairwell" supposed to use the same addresses?

// Otherworld Hotel Kitchen

007FEB10 00000000 // Movable Object Brightness (Red); 0
007FEB14 00000000 // Movable Object Brightness (Green); 0
007FEB18 00000000 // Movable Object Brightness (Blue); 0

// Otherworld Hotel Stairwell

007FEB10 C1C80000 // Movable Object Brightness (Red); -25.0
007FEB14 C1C80000 // Movable Object Brightness (Green); 25.0
007FEB18 c1C80000 // Movable Object Brightness (Blue); -25.0

@Polymega
Copy link
Collaborator Author

Polymega commented Feb 27, 2019

I think that was a typo. It should be this (only showing the memory addresses, not including any ASM below):

// Otherworld Hotel Kitchen

007FEB10 // Movable Object Brightness (Red); 0
007FEB14 // Movable Object Brightness (Green); 0
007FEB18 // Movable Object Brightness (Blue); 0

// Otherworld Hotel Stairwell

007FED00 // Movable Object Brightness (Red); -25.0
007FED04 // Movable Object Brightness (Green); 25.0
007FED08 // Movable Object Brightness (Blue); -25.0

@elishacloud
Copy link
Owner

@Polymega, @AeroWidescreen, below is my first attempt to add this feature into the module. Take a look at it and let me know if I made any mistakes. I did some quick test, but not sure exactly what it is supposed to look like.

Test module: d3d8.zip

Note: this only works on v1.0.

@Polymega
Copy link
Collaborator Author

Awesome! Thanks Elisha.

I have an immediate observation for this fix:

  • The game crashes as soon as the flashlight touches/interacts with any dynamic/movable object (items, enemies, NPCs, etc).

@AeroWidescreen
Copy link
Collaborator

AeroWidescreen commented Feb 28, 2019

@elishacloud

The crash is being caused by this section of the code:

// Maximum Movable Object Brightness

004FF1F0 fmul dword ptr [address] // value of address used here = 0.7 float (3F333333)
00502BC0 fmul dword ptr [address] // value of address used here = 0.7 float (3F333333)

You're putting "3F333333" in the brackets, instead of the address. Kind of surprising that this was the problem, considering how easy it is to mess up the rest of the code. lol

@elishacloud
Copy link
Owner

Thanks @AeroWidescreen and @Polymega, Try this one. It should no longer crash: d3d8.zip

@Polymega
Copy link
Collaborator Author

This was probably the hardest fix to implement over all the recent fixes we've been adding. And... with the exception of that one little snafu at the beginning... everything worked great! Well done! Great work with its implementation Elisha, and excellent work once more for your creation here Aero_!!

@elishacloud
Copy link
Owner

@AeroWidescreen, I am working on converting this code to work on all versions of SH2. However I am having trouble figure out how get several addresses programmatically. In the test module I just hard coded the addresses for v1.0.

Any idea how to programmatically get these addresses?

  • 0x007F72F0
  • 0x007FEB10
  • 0x007FED00

@AeroWidescreen
Copy link
Collaborator

@elishacloud Try this.

Location of pointer (v1.0 exe): 0047C309 008037E0
Location of pointer (DC exe): 0047C7B9 008063C8
Cheat Table: Download


0047C309, Offset +24, Offset +680 = 007F72F0
0047C309, Offset +24, Offset +684 = 007F72F4
0047C309, Offset +24, Offset +688 = 007F72F8


0047C309, Offset +34, Offset +2A0 = 007FEB10
0047C309, Offset +34, Offset +2A4 = 007FEB14
0047C309, Offset +34, Offset +2A8 = 007FEB18


0047C309, Offset +34, Offset +490 = 007FED00
0047C309, Offset +34, Offset +494 = 007FED04
0047C309, Offset +34, Offset +498 = 007FED08

@elishacloud
Copy link
Owner

Thanks @AeroWidescreen! That is exactly what I needed.

Here is an update that should work on v1.0, v1.1 and DC. Take a look at it and let me know if there are any issues with it.

Testing module: d3d8.zip

@AeroWidescreen
Copy link
Collaborator

@elishacloud
I don't know if Polymega plans on doing a full playthrough or not, but it seemed OK for me. The ASM for each part of the code looked fine the last time I checked. I also checked a few common problem areas in the game using v1.0, v1.1, and DC executables and they were all fine. No crashing, no bugs.

@elishacloud
Copy link
Owner

Thanks @AeroWidescreen, code for this is in check-in eb54c20.

@Polymega
Copy link
Collaborator Author

Polymega commented Mar 2, 2019

Sorry for the slight delay. Like Aero_, I didn't do full playthroughs for all versions this go-around, but tested all the specialized rooms/cutscenes that this fix adjusts (where it's most likely to break) and it all works great across the board. Great work again, gentlemen.

@elishacloud
Copy link
Owner

Thanks @Polymega. We are one step closer to releasing the next update.

@Polymega
Copy link
Collaborator Author

Polymega commented Mar 4, 2019

Yes sir.

@AeroWidescreen would you want to finalize the lighting transition bug fix for this release as well? Version 2 of your Cheat Table has it all working and just needs one additional room added to it, and light address value changes for two of the areas to complete it.

(Please ignore all the specularity posts below in that thread. The conversation migrated to an appropriate thread later on.)

@Polymega
Copy link
Collaborator Author

What an amazing--and amazingly-challenging--fix this turned out to be. But Aero_ shined brightly and Elisha ported it home. And thanks to Bigmanjapan for much of your research with the flashlight as well, which absolutely helped in many aspects!

An update has been released with this fix in it. See v1.3.1340.0

elishacloud pushed a commit that referenced this issue Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants