#Modding the MGS1 emulator

1 messages ยท Page 19 of 1

pure radish
#

man we are using all the tools at our disposal here lol

#

now its pink

dawn flare
#

lol

pure radish
#

literally what are we doing

#

but wow i have much better tools now lol

pure radish
#

i guess I want wmemset

#

now red

#

but none of this displaying

#

no that disappeared the first time i wrote to it

dawn flare
#

nvm, derp

pure radish
#

so i went to menu and let it go back to the opening sequence

#

now i broke title big time

#

what the fuck

#

LOOOL

#

what

#

guys computer in the sub intro sequence was going totally schiz

#

cycling through all colours

#

even though i didnt write to it during the cutscene

#

stuff just not getting reloaded i guess

dawn flare
#

_>

pure radish
#

but the "TITLE" thing

#

if I overwrite it, I have to leave this screen, let it start playing the intro, and then come back here to see it change

#

it doesn't immediately update

#

ah man how the fuck do video games work

dawn flare
#

Magic, I think

pure radish
#

there can't be anything in the framebuffer area

#

100%

#

i painted that purple at "TITLE"

#

it went to the menu screen and then back to the cutscene

#

and its still purple but everything in the bottom half is animating with cutscene textures

#

streaming upwards for rocks and stuff

#

ignore bro's expensive technicolor DJ decks

#

so its clearly like

#

"TITLE" is painted from i guess, a foreground / background colour in the texture memory

#

to the framebuffer, which I can't see

#

coz its not there

#

and by overwriting the i guess, two pixels in the texture memory, i get coloured squares

#

kind of explains the lights party going on with the computers here too

#

so where is it taking the framebuffers, only to plop them onto this before sending it to the host GPU

#

well that categorically confirms something I believed but wasn't sure about before

#

framebuffers are not in the PSX VRAM

#

but by the time its in the GPU frame capture, they're a package deal

#

at least renderdoc isn't making it obvious that they're composited somehow

dawn flare
#

Huh, neat

autumn raft
#

maybe they were planning for psycho mantis to read way more types of save data

rancid hare
#

That's on the list of things he does read
SLUS-00067 Castlevania: Symphony of the Night

dawn flare
#

Duh

#

I don't know why I didn't think of that

dawn flare
#

I think I thought it was text from the emulator, not text from the game itself

pure radish
dawn flare
#

Have you tried being optimized?

pure radish
#

the last thing I am is optimised

dawn flare
#

But we love you regardless

rancid hare
#

god i should've added this sooner. gonna save so much time troubleshooting people's crap lol

pure radish
#

really? not sure what I'd even do with that information

dawn flare
#

Me: Restarts my computer
Also me: Why is WinDbg running first thing in the morning?

pure radish
#

what crashed lol

#

explorer.exe

rancid hare
pure radish
#

you need to do if (intel) dialogbox()

rancid hare
#

Have the box say "hey get a refund bro." lol

dawn flare
dawn flare
#

The PC autorestarted overnight for an update, so it probably just crashed out during the shutdown

dawn flare
#

rofl, just closed and reopened GOG and it crashy-crashed

pure radish
#

tbh i'm using Playnite

#

Galaxy seems abandonware

dawn flare
#

I only use it for my gog games

#

ยฏ_(ใƒ„)_/ยฏ

pure radish
#

ah yeah i use it to install them

pure radish
#

apparently the titanfall games use squirrel lol

#

(our hooks are way better though)

#

yeah nothing here that's useful, we're lightyears ahead

dawn flare
#

That's wild

pure radish
#

lol

#

my native code hooking stuff now is great but

#

if you typo it produces some insanely cryptic errors

#

actually crashes microsoft's compiler

pure radish
rancid hare
#

Ooo.

pure radish
#

oh wow that's cool

#

was that in the latest VS update

pure radish
#

hmm

#

i managed to make the framebuffers disappear in renderdoc

#

so maybe my live memory viewer is lying to me

pure radish
#

it would make a lot of sense as it would mean I was looking for something that doesn't exist

#

and simultaneously the thing I was looking for was in front of me the whole time

#

so i guess i need to try something else to prove that the framebuffers are in fact there

#

apparently i don't understand pixels

#

it's actually transparent

#

well that is fucking interesting

dawn flare
#

_>

pure radish
#

well thats why i tried to write to it

#

you werent ignored lol

dawn flare
#

No I know ๐Ÿ˜›

#

But now I know I was riiight

pure radish
#

there has to be other good tools like renderdoc

#

i have all the sekrit tools for anything but graphics

#

someone needs to spill the beans

#

hmm this thing categorically says the whole area is ARGB(255, 0, 0, 0)

pure radish
#

well this is fun

#

trying graphics debugging in visual studio

#

wonder if this will shine new light

dawn flare
#

Iiiinteresting

pure radish
#

okay

#

that has actually revealed something that renderdoc did not

#

the UpdateSubresource call has missing framebuffers

#

they appear via CopySubresourceRegion

#

copy from where though

#

this guy

#

who are you LOL

#

that's fascinating

#

finally, some clarity

#

ID3D11Device->CreateTexture2D({Width=2400,Height=1440,MipLevels=1,ArraySize=1,Format=DXGI_FORMAT_R8G8B8A8_UNORM,{Count=1,Quality=0},Usage=D3D11_USAGE_DEFAULT,BindFlags=D3D11_BIND_SHADER_RESOURCE|D3D11_BIND_RENDER_TARGET,CPUAccessFlags=0,MiscFlags=0},{{addr,SysMemPitch=9600,SysMemSlicePitch=13824000}},obj:32)=S_OK

#

that's the chap

#

then you get

#

ID3D11DeviceContext->CopySubresourceRegion(obj:40,0,0,0,0,obj:32,0,{left=0,top=0,front=0,right=320,bottom=224,back=1})

#

and its obvious why it doesn't work

#

copy 320x224 from 2400x1440, nice one

pure radish
#

finally a thread to pull on

crude zinc
#

since when the hell can you debug rendering in VS

pure radish
#

hahahaahahahhaa

#

i've been industrious in my madness to solve this

crude zinc
#

I made my own full opengl engine recently and I had no idea

#

so secret

pure radish
#

first you have to open some DirectX control panel I've never seen before to enable the debug layers

#

then I think you also need the optional Windows graphics debugging component

#

then change some random settings in VS until the "start graphics debugging" option is not greyed out

#

but this seems to have slightly more information than renderdoc in this case

#

or renderdoc does an incredibly good job of hiding it

#

XP-ass dialog box is part of the process

#

and this

#

its greyed out for me now because i have a session already going

crude zinc
#

sounds very directx specific

pure radish
#

most probably yeah

crude zinc
#

even if you enabled validation layers in any other graphics api I get the feeling it wouldnt work

pure radish
#

hopefully i have enough info now to go back to IDA, my comfy place

#

a few minutes?!

#

even this is a little unintuitive and clicking random things reveals an entire universe within

#

renderdoc is terrible for that

#

well its still collecting that object data

#

fire up doom while we wait

#

this is my first time using chatgpt as well, no idea how it can answer these questions because google can't

#

whoa

#

is VS actually telling me where CreateTexture2D is called in METAL GEAR SOLID.exe

#

METAL GEAR SOLID.exe!634f02 Symbol file not found. Ln:0

#

seems really unrelated code, it's an accelerator routine for acc_mgs_r3000_us

#

maybe it's trying to produce that via stack frame analysis

#

i'll find it anyway

pure radish
pure radish
#

well I found the CreateTexture2D calls but it seems they are created at startup and then updated on frame

#

this is a crazy merry-go-round

#

you can create them with "initial data" but since they're not recreated each time, i need to look for the update

#

thanks ChatGPT

pure radish
#

lets see if ChatGPT is correct

#

two functions call UpdateSubresource, cross-referencing with my v1.2.2 database (lol)

#

so one of these should be 2400x1440 rgba8888

#

otherwise, more merry-go-round

pure radish
pure radish
#

aight, back to it

pure radish
#

that's new

#

i need to renderdoc this

#

../emu_psxbase/emu_psx/gpu.c:576: 'tp < 3' failed

pure radish
#

clearly doing some render to texture here and multiple passes

#

those framebuffers are never in CPU land

#

then the wires get crossed because it tries to recreate the PSX VRAM in the GPU

#

i need to resize that VRAM texture to create space for this

#

or shrink this down (but then we lose upscaling i figure which kind of defeats the point)

#

this guy

#

coz he only 1024x1024

#

but all the shit already there needs to scale up with it

#

๐Ÿค”

#

that means loading my own shader tho

#

isn't this avoidable by redirecting accesses to the framebuffer area (which has the broken copy) to the source rendered texture

pure radish
#

there's so many ways of solving this in theory but what is easiest

pure radish
pure radish
#

i can conceive of a way of doing this

#

maybe i'll need to link the d3d11 sdk... otherwise will go mad

#

"i enjoy locating vtable methods" said no one ever

#

this GW_DX11_ProcessCommandBuffer hook ought to be sufficient for knowing when to jump in and rescue it

#

at a certain point in that pipeline, would need to run a shader to upscale the texture, I think

#

as a basic test of the theory maybe i'll just hack the creation of the VRAM texture so it's bigger, that should be visible ingame (and even more wrong at the moment)

#

then "unhack" that because the upscaling will be a separate texture

#

it would be like

#

let the game do what it's going to do up to a certain point

#

run upscaling shader to render to a larger texture

#

inject that texture instead of the game's original

#

then resume the original pipeline

#

if we're right about the original shader's math that should work

pure radish
#

everything is there if you probe it enough

crude zinc
pure radish
#

oh yeah i can do it but

#

programmatically

#

thats how i know what the different parts of this function are doing

#

but to actually call it myself in the mod at least needs a header lol

crude zinc
#

I just did this cool shit, no actual sdk references, chatgpt helped a lot

pure radish
#

in this house we engineer graphics with large language models

crude zinc
#

lifes too short to really fully give a fuck about magic computer bullshit

pure radish
#

ngl i have not really found anything else to use chatgpt for

#

but it has been helpful here i will admit

#

is that shader you use builtin to the game? or a custom one?

#

coz i suspect (because chatgpt said it) i will need a custom one but a very simple one

crude zinc
#

its a custom one

pure radish
#

aight cool so there's prior art here

crude zinc
pure radish
#

oh damn compiled on the fly

#

thx, thats helpful

#

MGS1 is very strange

#

it has precompiled shaders

#

right next to the source which is also included

crude zinc
#

I didnt immediately find raw shader source in mgs2/3 either, probably precompiled everywhere

#

but d3dcompiler_43 is there.. soo..

#

might as well use it

pure radish
crude zinc
#

what a beautiful string

pure radish
#

meanwhile:

#

this is whats actually used

#

so no idea why the source is there

#

im going to hook the d3d11 methods themselves to get even moar logging i think

#

then we're really cooking with gas

pure radish
#

works lol

#

surprised the mod loads before D3D11CreateDevice, tbh

#

m2fix new hooking stuff is metal lets be real

#

that's one way of getting the ID3D11Device

pure radish
#

hell yeah

#

now should be able to change the texture sizes

#

ok conceptually it works

#

lmao

#

inevitably it reads more data from the CPU and causes an access violation

#

so i guess i just proceed with the grand plan now

pure radish
#

i can D3DCompile the shader ChatGPT gave me

#

that's good progress

pure radish
#

the headache means it's bedtime

pure radish
#

that seems like a good point to interject

#

swap out the texture passed to CreateShaderResourceView

#

but keep track of the original

#

then at some stage to be determined, upscale the original texture with that shader to my replacement texture

#

and it will surely just work first time

#

I know for certain that's the texture

#

it's the only one with that size and pixel format

#

this would not have been possible with how m2fix worked before the rewrite

#

complete fucking mess, would take half a day to do something that now takes a minute

pure radish
#

i think i have all the important d3d11 stuff hooked

#

and all of it cascades from D3D11CreateDevice lol

#

no game knowledge required

#

hooks hooking hooks hooking hooks

red cradle
#

the power of hooking

pure radish
#

this is some good stuff

#

this is the draw call using the too-small texture

#

as per usual not throwing all this logging away when done, will just turn it off by default beluga

#

it's too much work to discard

#

hopefully I will get some sleep

woeful flare
#

woahhhh, so much to catch up on Starryeyed

pure radish
#

i have slept and i am moderately refreshed

pure radish
#

started sketching what's required... im crashing my GPU now, but i'd prefer that to crashing the game ๐Ÿ˜„

#

it's gonna be a lot of fiddling

#

I guess this is where renderdoc will be most useful

pure radish
#

cool, its my draw call crashing the GPU

#

so i guess i just havent set it up correctly

#

the rest of the stuff im doing doesnt interfere

pure radish
#

duh, would help if i actually uploaded my shader to the GPU

#

i think i need a vertex shader as well

#

(which chatgpt has also generated)

#

ok good sign, GPU no longer crashes

#

yuss, I see my "activity" in renderdoc

#

now i need to make it work loool

#

thats progress

pure radish
#

sorted a bunch of API errors so getting closer

pure radish
#

looks like i have the pipeline fuckery sorted but my texture upscaler isnt doing anything lmao

#

that drawcall is my doing

pure radish
#

we're really fuckin in there now

#

OH GOD

#

MGS The Matrix Edition

#

dude that is honestly such a vibe

rancid hare
#

๐Ÿ‘€

fringe shore
#

Hype intensifying

pure radish
#

oh my god

#

the pipeline interpolator just fucked me for like an hour and a half

#

i specified TEXCOORD0 but it ended up binding it to register 1

#

thanks chatgpt for eventually getting me there

#

now we have this!!!

#

it's upside down and flipped horizontally as well, but

#

it's a start!

#

better....

dawn flare
#

I hate thanking chatgpt, but it's for a worthy cause

pure radish
#

i need to turn all these debug prints off now as its massacring my framerate

#

now we have more space for framebuffers

#

for now im just doubling it

#

but it'll need to work it out from resolution eventually

#

so now i need to copy moar framebuffer data in

#

which I can do outside of all this new logic and shader stuff thankfully

#

there we go, normal framerate again

#

oof, surely huge breakthrough here haha

#

oooooh shit

#

it begins...

#

now we're here we can say konami definitely could've done this themselves

#

i had a linear filter on by mistake, changing to nearest neighbour has made "TITLE" render correctly

#

1700 lines of code, fuck me

#

i was kinda worried about "TITLE" for a sec but it was easily fixed

dawn flare
#

YEA BUDDY

pure radish
#

its a lot lol

pure radish
#

the last bits here are extremely fiddly lol

#

faffing around with loads of numbers again

#

the framebuffer effects are very trippy unless i get them exactly right

#

oh shit i kinda got it

#

that's almost lined up haha

#

im actually glad i got this close, it was miles out until just now

#

it's got a bit of the "pirated film that was recorded in a cinema" look to it

#

but given it's so minor now it can't be too hard to tune that out

#

i suspect there's some coefficients being passed to a shader that control things like the scale of underwater "wobble" and such

#

and those are being amplified rather than scaling correctly

#

so might need to scale them manually idk

pure radish
#

its probably just about playable now lol

#

but im not rushing it out after last time

pure radish
#

well this wont be tedious at all

#
    if (pDstResource == reinterpret_cast<ID3D11Resource *>(texVram)) {
        pDstResource =  reinterpret_cast<ID3D11Resource *>(texVramRemastered);
    }
#

lining up the codec digits is probably the way to go

#

everything should fall into place then (besides the extreme jitter)

#

then i need to work out how this is going to scale with different desktop resolution

#

that's horizontal done

#

it might not look like it because of the extreme shaking going on

#

50% of the time it overhangs left, 50% overhang right

#

wow is it hard to time that screenshot correctly

#

phwoar

#

definitely playable now

#

hard not to be delighted

#

if i never have to see OOoZ? again ill be happy

pure radish
#

nice, fixed the pause menu and borders

pure radish
#

bedtime, good progress

red cradle
red cradle
#

huh I remember you have an account that is also Afevis

rancid hare
#

Unfortunately an automated spam detector flagged this link (which is the likely RL location of MGS3) as spam and I got shadowbanned on the spot. Been waiting on an admin to review the appeal - their estimate said it can take a few months for them to get around to looking at it though ๐Ÿ˜ฆ
https://eurasia.travel/tajikistan/bokhtar/tigrovaya-balka/

Discover the breathtaking Tugay forests of the Tigrovaya Balka Nature Reserve in Tajikistan! This video guides you through the lush greenery and unique biodiversity that make this region a hidden gem. From towering trees to vibrant wildlife, explore the stunning landscapes that define the Tugay ecosystem. Learn about the importance of conservati...

โ–ถ Play video
red cradle
#

ah I see

pure radish
#

i wake up and visual fucking studio has reset my fonts again with no user input

#

standard

#

literally hasnt been touched i have been asleep

pure radish
pure radish
#

tidied it up a bit so it doesn't create the logging-only hooks if logging is disabled

#

so these are all the functionally necessary hooks for the fix

#

still a lot tbh

#

ClearDepthStencilView is the key one, ended up being a good trigger for most of the pipeline adjustment

#

it only appears once and at a safe point

#

i had no chance trying to fix this the way i would've tried last year

#

i didnt expect to have to fuck with d3d11 so much

#

because we got so far without doing that

#

but there really was no other way

pure radish
#

ALSO absolutely no fucking chance i could do it last year with how i was hooking stuff then, even if i knew what to do

#

sorry ppl had to wait but there was no alternative lol

pure radish
#

alright got rid of all the stuff hardcoding it for 1440p lol

pure radish
#

i've fixed the "recorded in a cinema" look

#

and things wobbling/shifting!

#

huh, that's really all the bugs fixed

#

how did i do that

#

sharp image borders now

#

no dancing digits was an unexpected outcome

#

the bugs are falling like flies now

pure radish
#

there is really only one issue left here

#

which can't be as hard to solve as everything else

#

it's not that things are actually "shifted", it seems like there's a scaling issue, like the aspect ratio somewhere is wrong

#

so i just need to fiddle with the numbers a bit

#

i have no idea what is going on with the PSX resolution

#

sometimes I see 320x256, sometimes 320x240, sometimes 320x224

#

the game is using any two of those seemingly simultaneously

#

so making sense of that will probably fix it

#

to be precise: the choice of game version selects one of the first two

#

the last one is always used for some part of the rendering pipeline

#

the first two must be PAL vs NTSC

#

no idea what the last thing is

#

but its very important in this emu

#

other than that issue it's perfect now

pure radish
#

bbl

rancid hare
# pure radish the game is using any two of those seemingly simultaneously
GitHub

Metal Gear Solid PSX reimpl repo. Contribute to FoxdieTeam/mgs_reversing development by creating an account on GitHub.

GitHub

Metal Gear Solid PSX reimpl repo. Contribute to FoxdieTeam/mgs_reversing development by creating an account on GitHub.

GitHub

Metal Gear Solid PSX reimpl repo. Contribute to FoxdieTeam/mgs_reversing development by creating an account on GitHub.

GitHub

Metal Gear Solid PSX reimpl repo. Contribute to FoxdieTeam/mgs_reversing development by creating an account on GitHub.

GitHub

Metal Gear Solid PSX reimpl repo. Contribute to FoxdieTeam/mgs_reversing development by creating an account on GitHub.

#

Definitely seeing those exact numbers around DG_InitDispEnv() a bunch in the decomp

pure radish
#

back

pure radish
#

oh awesome

#

with the new stuff, those values i didnt understand so stuck them in the ini file no longer need overriding

#

so i can remove some user-facing complexity here

#

the "layer width" "layer height" stuff can go

pure radish
#

224 must be the size it uses to perform the framebuffer effects on

#

that would make some sense maybe

#

224 is a "cinematic" thing

#

according to psx-spx that's generally how its used

#

that is without me shifting it

#

with some updates to the ratio & scaling

#

now why is it vertically wrong

#

the digits also look the right size now

#

i think?

#

need to thimke

#

there is some beautiful solution here without hacking it, must be

#

the scaling is right now if i hack the vertical offset

#

i was worried for a bit because the text was too big

#

this is so close its unreal

pure radish
#

im afraid to touch it in case i make it worse lol

#

scalpel precision needed at this point

dawn flare
#

๐Ÿ‘€

#

Make sure you save your game

pure radish
#

the game is internally actually doing this

#

this is without the mod

#

so it being there in the non-presented framebuffer is 'normal'

#

crude way of measuring it, but that is clearly too low

#

and it comes from a CopySubresourceRegion, supposedly

#

so in the unmodded game its sourced from a texture of 640x512

#

the mod currently causes that texture to be created as 2250x1440, no idea where it gets 2250 from

#

that is not the same ratio

#

lets see where that gets created

#

hopefully some dots about to get connected

pure radish
#

ok corrected that texture size

#

hasnt fixed alignment tho lmao

pure radish
#

gonna say they're lined up in the vertex shader

pure radish
#

that's without a hacky shift

dawn flare
#

๐Ÿ‘€

pure radish
#

god am i glad to get rid of the shift shite

#

why does this happen man

#

last 3 days

#

i go to bed

#

suddenly have eureka

#

get up, and something gets fixed straight away

#

spend hours sitting here trying to fix it

#

lie in bed for 5 min and gg

#

yeah

#

im calling it

#

it's fixed

#

it's done

#

job done

#

works flawlessly

#

just closed about a million things, feels good

#

and all the screen modes work fine as well

#

nice

#

no hacks here its all science

#

3am pizza to celebrate

#

so glad i can get rid of these lol

red cradle
#

that's a good progress

dawn flare
#

Amazing!

pure radish
#

mind blown

dawn flare
#

Is there a way to change the border wallpapers when playing 4:3? I don't remember

pure radish
#

there's a few you can choose from ingame

#

unless you meant like custom ones

#

custom ones could probably be done as well tbh

dawn flare
#

Was thinking custom ones, but I'll throw in a feature req after this version goes up ๐Ÿ˜‰

pure radish
#

yeah, its probably not too difficult, certainly not as difficult as all this shit was

#

lol

#

i really opened a can of worms here

dawn flare
#

Be handy for Castlevania too

#

You did so good!

pure radish
#

ty! โค๏ธ

dawn flare
#

Did someone give you extra ko-fi donations? ๐Ÿ˜›

pure radish
#

no lol

#

havent had a dono in a year (understandably)

dawn flare
#

Works a little iffy right now, but I'll toss you a couple bucks when things are a little more stable

red cradle
#

I wonder if it's doable that makes text and UI non-stretched when play it in widescreen

dawn flare
#

That'd be ideal, but like Snake, nuggs deserves to rest :p

#

Definitely would love to see it down the road

pure radish
#

just gonna leave it playing the intro on my monitor tonight lol

dawn flare
#

Perfect

#

Get that text nicely burnt in

pure radish
#

it's not just that it works from my POV, it's how elegant it is lol

#

very satisfying solution

pure radish
#

thx to the two people who sent me ko-fi if you're in here โค๏ธ

autumn raft
# pure radish

am I tripping or does it seem a few pixels to the left (the 1 looks like that at least)

pure radish
#

it's not

#

the texture just upscales in a strange way

#

it's not a positioning thing, that's just how the shader decided to colour the pixel via nearest neighbour

#

maybe that can be tuned a bit more, but the positioning is correct

#

tuning that is much less stressful lol

autumn raft
#

Yeah thf it might just be me trying to find an issue even when it isn't there, some projects I make take a long time because of that lol

pure radish
#

i have to define the sampler for the vram upscaling

#

and i have no idea what im doing, this is just the first thing that worked

#

lol

#

positioning must be correct now because there's no hacky alignment or shifting in my stuff anymore, it's all based on ratios

#

that is where it should end up, apparently

fringe shore
#

Comparing it to a screenshot I took off a psx mgs1 video on YouTube it looks spot on to me

pure radish
#

yeah

autumn raft
fringe shore
#

To be fair most of us are probably used to seeing this on an old crt screen. I didnโ€™t know it looked like that normally either lol

pure radish
#

alright, time to fix PAL

#

this shouldnt be too bad

#

i think i already found the problem

pure radish
#

that's some PAL progress

#

but yes, compressed horizontally

#

but at least the text has appeared now

pure radish
#

oh now i know why integral has black borders

#

not sure if that's intentional or a mistake lol

#

got it

dawn flare
#

Be interested to see if any of the upscaling works with the 2d Castlevania games

pure radish
#

nope

#

noooooope

#

highly doubt lol

#

are they d3d11 even

dawn flare
#

Lol no idea

#

Yeah I didn't think it would regardless

rancid hare
# pure radish

Oh hello. Where are you hooking for that?

I've been trying to hook into d3d11createdevice with MGSHDFix to redirect it to d3d11createdeviceandswapchain, but it's just been crashing on me. I figure there's probably somewhere further down that I need to hook it to inject my own d3d11_sampler_desc

#

(since that controls refresh rate, antialiasing levels, ECT.)

pure radish
#

why do you need to redirect to D3D11CreateDeviceAndSwapChain to set a D3D11_SAMPLER_DESC?

#

(i am not)

#

I'm hooking D3D11CreateDevice, letting it run, and then using that to springboard more hooks into the ID3D11Device methods

#

and so on for ID3D11DeviceContext when it runs CreateDeferredContext

#

looks like this

#

but I don't do anything with D3D11CreateDeviceAndSwapChain

#

FUCK YEAH

#

completely fixed PAL

#

now has NTSC broken

#

a bit

#

FUCK

rancid hare
pure radish
#

i didn't know any graphics at all 5 days ago

#

it's been a bit lmfao

rancid hare
#

I definitely hear you lmao

pure radish
#

cool, fixed NTSC again

#

we are zeroing in here haha

#

now does PAL still work..

#

YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSSSSSS

#

disgusting dude, it's perfect

#

party time

#

once again this needs to get the fuck into git

#

it's in git, we are safe

pure radish
#

well fuck, now to... work on something else

dawn flare
#

I'm sure we can find something for you to do

dawn flare
#

Is it even possible to split the HUD and Subs out of the widescreen effect? Like was mentioned the other day

pure radish
#

funny you mention that, i just reworked the widescreen so it doesn't need PsyX anymore

#

so we're back to using M2's GTE

#

the new widescreen hack

#

extremely tidy

#

wow i can delete so much shit due to this

#

and i'd rather be using as much of the original master collection code as possible

#

this is gr8

dawn flare
#

Holy balls dude, you're on a roll

dawn flare
#

Jesus

pure radish
dawn flare
#

lol

pure radish
#

"asking for donations" is having a tip-jar link now

dawn flare
#

I mean, I do kinda get that the project looks dead if you only have the github to go on

#

But also, don't be a dick

pure radish
#

well its the personal attacks and assumptions yeah

dawn flare
#

Oh fer sure

pure radish
#

he's being an arsewipe

dawn flare
#

When are you thinking you'll throw the latest build up for release?

pure radish
#

not even dignifying him with what is wrong with "you", it's what is wrong with "people" haha

red cradle
#

like dude it's a project with passion, not a real job

pure radish
dawn flare
#

Ah, totally fair.

pure radish
#

i will take my time

dawn flare
#

Fer sure

pure radish
#

you've waited long enough already, a bit longer won't kill ya

dawn flare
#

Yep! Just kinda curious what the gameplan was, since things are looking real solid (lol)

pure radish
#

honestly i probably need to play through it now in both PAL and NTSC

#

and maybe with one of them at a different desktop res

#

then re-test all the non-MGS1 games again

#

petrified of what happened last time haha

#

about time i fucking play this goddamn piece of shit

#

also shit like the readme needs updating

#

these things all add up lol

#

if he replies again he's getting this gif

#

i am done speaking

dawn flare
#

I wish I was getting hairdryered

#

@pure radish If you need a playtester, lemme know. Am happy to assist ๐Ÿ™‚

pure radish
#

bang and the dirt is gone

dawn flare
#

lol

#

lmao even

pure radish
#

who needs this shit in their life

rancid hare
#

i wonder if he's the same cunt i blocked from the nexus pages saying the same crap lol

dawn flare
#

Probs

pure radish
#

always no repos/commits/contributions from these inbreds

#

but a big mouth

red cradle
dawn flare
#

I just did a redownload, lemme take a look

#

Maybe it's already doable

pure radish
#

just taking all the trash out

dawn flare
#

Unless it's unpacked on first launch or somethinfg

pure radish
#

probably in some extremely fucked up file format

#

like most of the game

dawn flare
#

Probably

#

Well, and then it gets messy depending on your aspect ratio etc

#

But might also be handy for folks who have ultrawides, where the stock images could potentially be borked.

pure radish
#

i don't have any ultrawides but I think I can still test it

#

by just setting a silly resolution in the ini

#

like it'll be a horizontally thin window

dawn flare
#

Are all the options from the OG launcher in the M2Fix config?

pure radish
#

well, not all of them, things like sound and controller ports are not lol

#

but there aren't ingame resolution settings

#

even for the window

#

the ini was supposed to just have options that arent ingame

dawn flare
#

I'm not gonna post an issue for it, but it would be very cool to either include the M2fix options in the OG launcher, or have a fresh GUI that includes the settings from both

pure radish
#

then they added the filters so that ruined that

#

lmao

#

but i hid them in the ini

dawn flare
pure radish
#

yeah, it's probably quite doable

pure radish
#

then the question is should changing them there update the ini

#

lol

dawn flare
#

I would think so Edit: That way anyone can get into the config and make those changes without dicking around with the launcher if they don't want to.

This would also, in theory, make Steamdeck support better since you don't need to dick around with the keyboard

dawn flare
#

But again, down the road

#

Did you ever figure out what was up with the chaff grenade audio?

pure radish
#

never even looked at it yet

#

i was hesitant to look at anything else until sorting the upscaling

dawn flare
#

I'm just poking through the tracker

#

For sure

pure radish
#

the only exception was to rewrite the entire project because i couldn't do upscaling without doing that haha

dawn flare
#

lolol

#

"I didn't look at anything except for looking at everything." ๐Ÿ˜›

pure radish
dawn flare
#

As always: Thank you for continuing with this project. It's amazing to see what you've done to take a decent-mediocre port and take it above and beyond

#

I'm also looking at all the issues you'll be able to squish in the tracker when the next release goes live ๐Ÿ˜›

pure radish
#

here's a preview of the updated README

#

great to see all those games in there

#

maybe I can combine the "Steam Deck/Linux additional instructions", need to try

dawn flare
#

Would it be worth a rebrand to "M2Fix"?

#

Since it's now a much wider scope?

pure radish
#

i've been thinking about that for a while

dawn flare
#

Redirect the MGSM2Fix repo to it

pure radish
#

it'll automatically do that i think

dawn flare
#

Handy

pure radish
#

it's still very MGS-focused though

dawn flare
#

For sure

pure radish
#

and i like it having that loyalty and history

#

maybe further in the future

dawn flare
#

But I could imagine a lot of people who play those other games completely missing out on it

pure radish
#

hmm

#

i'll think about it

dawn flare
#

ยฏ_(ใƒ„)_/ยฏ

#

No strong feelings, and it's your project.

pure radish
#

yeah i mean i was already thinking about it so

#

i haven't really decided yet

#

i swing both ways haha

dawn flare
#

๐Ÿ˜‰

#

If there's any generic config vs MGS config, I'd maybe split that out in the readme. Also include a folder location example for installation that isn't for MGS

#

Maybe that first bit is more in the ini rather than the readme

#

Don't want people flipping switches that do nothing in, I dunno, G-Darius HD.

pure radish
#

also going to put some more screenshots in there to show off the fixed intro and codec ๐Ÿ˜›

#

it's crazy it supports so many games haha

dawn flare
#

Right?

pure radish
#

like that's a lot

#

the credits changed a lot in the rewrite as well

#

haha

#

stuff taken out new stuff added

#

technology innit

dawn flare
#

"Countless people in the MGN Discord for encouraging the project along; " It me!

#

and you!

pure radish
#

i'd put names in there but i think the line is "you need a github account"

#

(so i can link it)

#

don't want to name people if i can't link a profile

#

i might try to automate some testing here

#

at least something that checks each game works

#

so i don't have to do it by hand coz its fucking tedious

dawn flare
#

That's probably a good idea regardless

pure radish
#

will also start drafting the release notes

pure radish
#

wow we really got a lot done

pure radish
#

love to update LICENSES.txt

rancid hare
#

oh wait

#

one more thing to add

pure radish
#

your monitor fix?

rancid hare
#

Corrects the monitor going to sleep during long periods with no input (e.g. during cutscenes.)

pure radish
#

yeah i caught it after i sent the screenshot lol

#

this stuff is all WIP, ill be tweaking it for a few days at least

#

so if some stuff seems missing i might add it (but still tell me)

#

this is why we don't rush releases ๐Ÿ˜›

#

always stuff to catch before it goes out

pure radish
#

extended my installer script so that it can also unpack the release zip

#

the release zip is structured differently to how i develop the mod so useful to have that

#

awesome that all works

rancid hare
#

oh wait a sec, you mod is an asi, right?

pure radish
#

it's two ASIs

#

lol

rancid hare
#

kay one sec, i'll make a pr for something

pure radish
#

the release now looks like that

#

but when I develop it's just "MGSM2Fix.asi"

#

so M2Install.py if called from Visual Studio, deletes "MGSM2Fix32.asi" and "MGSM2Fix64.asi" before copying "MGSM2Fix.asi"

#

but if you call M2Install.py --package, it extracts the zip and deletes "MGSM2Fix.asi"

#

chaos lol

rancid hare
#

want me to build off the old master / are you waiting for release to push?

pure radish
#

yeah waiting for release

rancid hare
#

will be just a few minutes then!

#

just bringing over some asi loader related fixes from mgshdfix

pure radish
#

huh

#

i just updated to latest ASI release

rancid hare
#

more that the framework we originally used weren't implemented properly, you're supposed to be able to load asi mods from /plugins, /scripts, and /update subdirectories

pure radish
#

oh

#

can you believe this was a fork of HDFix

#

lol

#

thats how i created the project

#

its some weird thing that looks like HDFix in some places but in other places its radically different lol

rancid hare
#

i stripped down everything and have been using it as a base for other games too, it's definitely solid lol

pure radish
#

right i think this is good to start some kinda automated test thingy

#

no fuckin idea how but

#

i need it to run the installer and then try launch each game and then close it

rancid hare
#

yeah i was thinking of doing cli stuff for mgshdfix too but i have no clue how you'd do that without hosting the .exe files with their dll's somewhere

pure radish
#

why would you need to host exe files to do that

rancid hare
#

which, with lyall getting supended from github with no warning the other day, i'm now super hesistant to do lol

pure radish
#

i have a "console" window now and the idea is to have some sorta commands u can enter eventually

#

atm all you can do on the console window is ctrl+c which triggers a breakpoint

rancid hare
#

er, countinous intergration tests*, cli was my brain being off in lalaland

pure radish
#

ohh

#

yeah I'm not bothered about CI, I just want some manual process that is consistent that I can run before releases

#

rather than going fishing through my steam list and hoping they all have the latest build and a consistent .ini

#

now i think, this automated test can try different ini options as well

#

start the game with different setups

#

i just need some sorta test harness basically

#

is this something i need to assemble myself or can i use pytest or something heh

#

god, I used to copy paste files around while working on this

#

what a tit

#

how did I cope

#

i think im changing it to be borderless by default in the ini

#

game behaves well with it so why not

#

i really need to figure out changing the keyboard bindings

#

that's a personal high priority

#

why the fuck is pause E+M

#

surely its possible to find a more natural conventional binding layout

#

how about escape for pause, honestly

rancid hare
#

oh right, master doesn't compile

pure radish
#

oh it requires the shitty intel compiler

#

quite trippy to launch VR Missions with that border lol

#

that freaked me out for a sec

pure radish
#

no more Intel compiler

rancid hare
pure radish
#

nice, i'll take a look

red cradle
pure radish
#

i dig that

#

saves me a job ๐Ÿ˜„

#

finished porting your PR, it was never gonna merge properly lol, everything has changed

#

i'll merge your PR to master, but force-push over it with a ported version to the mod rewrite

#

(will keep commit author though)

#

lets see how this works

#

not sure about the steam deck thing

#

there probably is a way to detect it, but i doubt that works

#

I would expect _WIN32 to be set on every system running the mod

#

i quite like that

#

Module Version: 0.0.0

#

that doesnt seem to work tho

#

tbh I imagine the M2 system requirements are lower, the GPU one will be most useful considering how much DirectX fuckery is going on now

#

operating system would be another good one to print

#

the directory stuff seems to be working

#

just module version is borked (but maybe it's just an M2 vs HD Collection thing idk)

#

not sure what it would be supposed to print

#

there has to be a way to detect steam deck coz loads of games do even with Proton

#

with the log directory maybe log rotation would make sense

#

i.e. keep the last X number of logs

#

I'll keep playing with it

hoary pier
rancid hare
rancid hare
#

oh well, when life gives you lemons
here's the date in a human readable format at least, confirmed it does work with mgs1 this time lol

std::string GetModuleVersion(void* module) { auto dosHeader = (PIMAGE_DOS_HEADER)module; auto ntHeaders = (PIMAGE_NT_HEADERS)((std::uint8_t*)module + dosHeader->e_lfanew); uint32_t timestamp = ntHeaders->FileHeader.TimeDateStamp; // Convert the timestamp to a human-readable date format (YYYY-MM-DD) std::time_t time = static_cast<std::time_t>(timestamp); std::tm* tm = std::gmtime(&time); // Convert to UTC time std::ostringstream oss; oss << std::put_time(tm, "%Y-%m-%d"); return oss.str(); // Return the formatted date as a string }

pure radish
#

i can probably get the game version through squirrel anyway

pure radish
#

cleaned up my game dir a lot haha

#

this was FULL of shit

#

i had memory dumps, multiple exes and ida databases, just so much shit

#

all i need is that v1.2.2 lol

rancid hare
#

Yeah one of the big reasons I fixed the ASI directory thing was cause I have 13 ASI mods for MGS2, each with a config, a log, a pdb, ECT. Had wayyyyy too much shit in there and it was getting annoying lol

pure radish
#

im prob gonna keep the asi in the root tbh, mine is the only mod

rancid hare
#

Especially since all my shit is symlinked, so I couldn't even sort by type

pure radish
#

though I guess.. in the release there are two ASIs

#

quite cool that the 32-bit vs 64-bit thing works as well as it does

#

relies on Windows silently rejecting a DLL for the wrong architecture

#

so that d3d11.dll is ignored by MGS1 and it uses the system one, and vice versa dinput8.dll is ignored by bonus content etc

rancid hare
pure radish
#

yeah

#

ASI loader works the same so MGSM2Fix64.asi is rejected by MGS1

pure radish
#

oh my god i am retarded at work today

#

context switching between work and MGS is dizzying haha

pure radish
#

seems like there's a lot of small separate mods for the HD games

dawn flare
#

I think I've seen like.. 3?

pure radish
#

but not for M2 coz im the only one interested haha

dawn flare
#

10/10

pure radish
#

the squirrel hook can only kinda exist in one plugin anyway

rancid hare
pure radish
#

why dont you combine em

rancid hare
#

one day maybeeeeeee. i like to keep mods pretty atomic just out of habit

#

also, hello therrrrrrrreeeeeee

pure radish
#

did you use the real d3d11 headers?

rancid hare
#

yup

pure radish
#

where did u get them

#

and whats the licensing like

rancid hare
pure radish
#

that should've been really obvious lol

#

i also obviously don't need to commit the header because anyone building can just do the same

#

fool moment

#

i'll need to see how my hooking/invocation stuff handles this though

#

__thiscall is a bitch to hook

#

but

#

this stuff is __stdcall

#

hmm

#

so what can i just do #include <d3d11.h>

#

i imagine i already have the bullshit installed

#

cretin

#

lets include it and witness all the errors that appear

#

alright well its in git lets totally demolish it

#

i mean that is nicer but what does it mean for hooking

#

ur mom lmao

#

yeah that's like

#

game over for hooking

#

I would still need to access the raw vtbl to hook them

#

i don't think you can cast away that error

#

every time ive seen it its pretty final

#

i don't think using the official header is worth it in my case

#

it makes my own calls look a bit neater but then I have no idea what's happening with this and I'll have some structs where it's explicit and some where it isn't

#

undo undo undo

#

i guess i'll finish off merging/enhancing your PR

#

fucking microsoft

#

tfw no IsWindows98OrGreater

#

best OS

#

maybe chatgpt can solve this as well

#

loool.

#

silly world

#

it's also wrong

#

11 is not detected

rancid hare
pure radish
#

LOL

#

WMI

rancid hare
#

Going by their documentation, this shoullllld return it as Microsoft Windows 11 Professional (build 22621)

pure radish
#

pain in the ass to include all that for it though

#

chatgpt has a solution

#

without using WMI

#

yea bro

#

getting GPU driver version would also be neat

#

but probably even more difficult

#

oh no chatgpt has an answer for that too

pure radish
#

ayy i got the driver version

pure radish
#

nice, found a bug

#

not in the upscaling

#

in the darius games, i had the wrong borderless patch assigned to them

#

this is why we take our time

#

dno how that happened, they were set to the MGS1 patch but they need the contra/castlevania one

wanton phoenix
#

Holy moly, I'm so happy the MGS 1 native res with filters got fixed, can't wait for release

#

I'm so happy I'll finally be able to play the game properly

#

Thank you for all your work, dude

pure radish
#

G-Darius HD is interesting m2engage

#

it has two playstations

#

"psx" and "psx_101"

pure radish
#

hmm,

#

I think ideal layout would be like

#

\plugins\MGSM2Fix32.asi
\plugins\MGSM2Fix64.asi
\logs\MGSM2Fix.log
\MGSM2Fix.ini

#

but i dunno about separating the asi from the ini, your code doesn't allow for that

#

but just having the ini in the root would be elegant

#

and hiding the 32bit 64bit shit

rancid hare
rancid hare
#

sweeeeeeeet, got @crude zinc 's shader injection stuff all working using the actual d3d11 header/functions. shaved 150 lines off of everything and reduced the initialization time from 115ms to 6ms

pure radish
#

nice

#

yeah, I just can't do that coz I need to hook the methods

#

idk how you know when to trigger it

#

I hook d3d11 itself to know where in the pipeline I am

rancid hare
# pure radish idk how you know when to trigger it

I'm still hook the d3d11createdevice and dxgicreatefactory functions just to make sure everything is initialized first & to cache the d3ddevice and d3dcontexts, most of it was just getting rid of all the hacky vtbl and global strut stuff that was going on in our implementation and replacing it with the proper d3d calls

pure radish
#

yeah but they aren't bound functions

#

you don't hook something like CreateRasterizerState

#

try doing that and you'll see the problem

#

you call it, but that's a big difference

pure radish
#

so

#

supposedly there's a hacky way to do it

#

but it's undefined behaviour

#

but i mean this only has to work on MSVC

#

so lets see what happens

#

the horrors

crude zinc
pure radish
#

it seems like there's different versions(?) of D3D11 as well?

#

like I can hook the wrong version of a function

#

(and am doing, with the official headers)

#

i got this far

#

but that is the "wrong" version of CreateDeferredContext, and the game doesnt call it

#

so the pointer I was getting from the vtable was different

#

it's a shame because it looks nicer lol

#

"The latest version of this interface is ID3D11Device5 introduced in the Windows 10 Creators Update. Applications targetting Windows 10 Creators Update should use the ID3D11Device5 interface instead of ID3D11Device."

#

yeah

rancid hare
#

yeah the whole d3d11 thing is a mess, there's d3d11_1.h,CreateDeferredContext1, d3d11_2.h, d3d11_3, d3d11_4.h, ect.

pure radish
#

so if i just change the header i include

#

will one of them eventually work

rancid hare
#

you'd change the number after CreateDeferredContext to match with the header too. theoretically it should lol

so annoying that they decided to split everything up by feature levels (ie directx 11 feature level 1_2) instead of just calling shit directx 12, directx 13, directx 14

pure radish
rancid hare
#

they match with the header file

#

ie d3d11_1 uses CreateDeferredContext1, d3d11_2 CreateDeferredContext2

pure radish
#

doesnt look like it?

#

oh

#

you need to do

#

&ID3D11Device1::CreateDeferredContext1

rancid hare
#

so fucking stupid lmao

pure radish
#

thanks, i hate it

#

not sure i have the energy to brute force the correct versions for everything lol

#

what a waste of time that would be

#

nope.avi

#

not worth it even

#

it would make the code less portable

#

to other games

#

i guess you could template it, but yikes, really enjoyed when i had to do that for squirrel

#

I'm sticking with vtbl

pure radish
#

could use this + some pointer arithmetic to work out the index

#

let me sketch how that would look

#

im apparently absolutely shattered today lol

#

got home, had a coffee, still took a 2 hour nap

pure radish
#

alright that can work

pure radish
#

holy fuck

#

i did it

#

gorgeous shit dude

#

oh I don't need that explicit template parameter either

rancid hare
#

Hell yeah haha

pure radish
#

basically

#

MSVC generates "thunks" in my binary that I can disassemble to find the vtable offset

#

even though they're the wrong version, the offsets are the same

#

so I can work out the offset and then take that across to the real vtable

#

it's rly fkn mental

#

but it works

#

and I can use the official header now

#

right

#

now i need to restore all the code i deleted and rewrite it to use this

#

im using the zydis for the disassembly that safetyhook itself is using

#

so no new dependency

#

i might not even need the "d3d11.dll" either

pure radish
#

no way dawg it fucking works

#

now i can call the functions like a normie

#

and the hooking is just

#

yet:

#

insane shit

#

all u gotta do bro,

#

is,