Help - Search - Members - Calendar
Full Version: Hex editing BGMAIN.EXE
The Black Wyrm's Lair - Forums > Mods under development - Baldur's Gate II > World Transition Project
Chevar
Okay, I've found the offending hard coded starting EXP for the TOB side of the interface.

I also seem to have found where the TOB side start area is coded, however I screwed up something else in the process.. I should have a working EXE soon.. Hopefully I'll find someone that can write a program to patch it instead of having to redistribute the exe
Awake
YAY!!!! Let me be the first to congratulate you in hard type, rather than IRC. Perhaps while your at it you could add subraces, more than 5 NPC's, and... yeah, this'll do fine. tongue.gif
Chevar
QUOTE(Awake @ Dec 30 2004, 02:17 AM)
YAY!!!! Let me be the first to congratulate you in hard type, rather than IRC. Perhaps while your at it you could add subraces, more than 5 NPC's, and... yeah, this'll do fine. tongue.gif

Bite my ass Awake smile.gif..

I have other work to do.. just doing what needs doing for WTP..
dragon_lord
Wohoo. Nice work Chevar, glad to see someones doing some work around here instead of loitering around in IRC happy.gif.
*dragon_lord looks in awake's direction and then realises the hypocrisy of doing so tongue.gif
Awake
Oh, real nice, dragon_lord. It's more than hypocrisy, considering you're on more than I am. tongue.gif

I have done a little bit of work... I have, really!

Anyways, so, who are we going to ask to make this patcher program. Like I said already, it's not a HUGE file, but like you said, it would be better to just distribute a patcher. Unless of course the patcher ended up being larger than the .exe.... Umm...yeah. OK, so now we all need to go into the ideas thread and see what we're going to do about the start area. I'm still for the idea that we put our guy in the room with no doors or windows and the guy teleports in. Anyways.... w00t.
igi
The ToB starting area offset is already known.
I'd be grateful if you could post the ToB starting xp offset.

Weidu can handle .exe patching. You could also use a tiny nsis 'installer' to do the patching.
egm
I have a question: is the starting XP of BGII alone hardcoded???
igi
BG2 as in BG2: Soa (ie. without ToB), or BG2 as in "not the other IE games"?

Either way, the starting XP for normal BG2 (without ToB) is hard-coded, but the offset is known, so we can edit the .exe file to change it.

The starting XP is probably hard-coded in the other IE games as well, but, iirc, they all start at 0, so... theres no point in changing it down, and it's probably easier to change it up via script or some such.
Chevar
QUOTE(igi @ Dec 30 2004, 09:25 AM)
The ToB starting area offset is already known.
I'd be grateful if you could post the ToB starting xp offset.

Weidu can handle .exe patching. You could also use a tiny nsis 'installer' to do the patching.

Sorry Igi, but my other computer (the one with the hex editor) is all tied up at the moment, so I can't get you the offset offhand. I'd love to trade info, however.. run a search for (hex) A02526 It's the third occurence. It's written in reverse of course. so if you change it to A0 00 00 you end up with 160 starting exp.. A02526 is the 2,500,000 starting exp (2625A0 in hex)

WEIDU can patch the exe? How?
Awake
My guess is probably one of the commands such as WRITE_SHORT or WRITE_BYTE, but I don't know much about that sort of thing, but it would make sense.
CamDawg
QUOTE(Chevar @ Dec 30 2004, 08:55 PM)
WEIDU can patch the exe? How?

WeiDU Documentation. Read it. Love it. Memorize it. (In this case specifically read, love and memorize WRITE_BYTE, WRITE_SHORT, and WRITE_LONG.)
egm
Okay then, I have a last question: what is exactly the offset which set the starting XP in BGII: SoA?
Vlasák
Egm:
the offset differs for the different length of the .exe. According readme included with xppatcher:

lenght - offset
-----------------------
7381038 - 0x64f8b0
7385134 - 0x6508b8
7417902 - 0x658970
7831598 - 0x6b5258
7839790 - 0x6b7258
7843886 - 0x6b6270
egm
THANKS!
SimDing0
This was useful, thanks, but does anyone know the ToB starting XP offsets for the various sizes of the EXE?
Vlasák
According Chevar's notice that it is the third occurence of 0xA02526 it is the offset 0x6B7264 for my bgmain.exe version (lenght 7839790).

BTW on 0x6B7258 is the SoA starting XP as we already now, but following dword (0x6B725C) has the value 161000 and another following (0x6B7260) 2950000 - these values are suspicious too... what is 161000 XP? I can't remember and not enough time for experiments with it... highest amount of XP for imported character? 2950000 is xpcap that can be removed by .2da... any ideas what can these values mean? (does the starting XPs in Tob differ for import from save game, character file and for the whole new game? I think that it does, at least in the case of starting XP for imports and new game).
Baronius
161000 is the experience cap of Tales of the Sword Coast...
If you start a new character in SoA, (s)he will have 89000 XP, however if you import a BG1 character having more than 161000 XP, his/her experience will be decreased to 161000.
SimDing0
I suspect that similarly, 2950000 is the maximum for an imported ToB character, while newly created characters are granted 2500000.

QUOTE
According Chevar's notice that it is the third occurence of 0xA02526 it is the offset 0x6B7264 for my bgmain.exe version (lenght 7839790).

Right, that's what I've got, yeh... I guess it changes for versions other than 26498 though.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.