Liberating Native Systems (morale error fix)

Liberating Native Systems (morale error fix); support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Bigmac57
Cadet 4th Year
Cadet 4th Year
Posts: 18
Joined: Tue Jan 20, 2009 3:00 am

Liberating Native Systems (morale error fix)

Post by Bigmac57 »

Hi all,

I was playing as the Federation and liberated one of my systems the Ferengi took from me.

In the Events screen, I got 3 messages:

Federation conquered [name] system

The brutal subjugation of ..... has many newswire...

The liberation of [system name] is the leading story of ....

So, as far as the Feds, am I really getting a morale bonus or losing 1 point, overall, in this whole thing?

This bug might just be for the feds.. I don't recall seeing it when I have played as other races.

Can someone please check this out?

Thanks!!
User avatar
Bigmac57
Cadet 4th Year
Cadet 4th Year
Posts: 18
Joined: Tue Jan 20, 2009 3:00 am

Post by Bigmac57 »

UPDATE:

Okay, the same series of 3 messages also appeared when playing the Romulans. I get the "Conquered" -- Subjugation -- Liberation message.

Are we getting gyped on Morale? That is, getting penalized, and then the morale reward, when we should just be getting the liberated message?

Or is the game supposed to work this way, i.e. its not a bug?

Thank you again.
User avatar
Bigmac57
Cadet 4th Year
Cadet 4th Year
Posts: 18
Joined: Tue Jan 20, 2009 3:00 am

Post by Bigmac57 »

Okay, actually for civs like the Romulans, because it works in their favor. But I think its a bug..

I checked the saved games in UE for System Morale (Before and After) and the numbers aren't right.

Sol went from 100 to 99 which means that it was a net negative. Corresponds to the Morale Chart too. First, the minus, then the plus, which nets to -1.

It should be the same as Minors. We need that code. It should be one or the other. You aren't subjugating first and liberating second. You are just liberating OR subjugating, as with Minors.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

You're right. Thanks for testing. :)


Using this info and remembering the research & advice of Gowron this is quite easy to fix:



Liberate Native - morale & message bug-fix:

Code: Select all

Trek.exe at 0x670BB

change:
31 C9 66 8B 48 44 0F BF 18 31 C0 BA 08 00 00 00 8A 84 24 14 04 00 00
to:
8B 48 44 0F BF 18 31 C0 8A 84 24 14 04 00 00 39 C1 74 09 31 D2 B2 08


asm 467CBB:
mov     ecx, [eax+44h] // inhabitant-ID
movsx   ebx, word ptr [eax]
xor     eax, eax
mov     al, [esp+414h] // attacker-ID
cmp     ecx, eax
jz      short loc_467CD7
xor     edx, edx
mov     dl , 8        // morale table-ID
Well, two bugs fixed today, still a billion to go... :roll:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Spocks-cuddly-tribble wrote: mov ecx, [eax+44h] // inhabitant-ID
Are you sure that this statement does not load any "unwanted" data into ecx? The original subroutine only loads a word, while your modification loads a dword. Is it certain that there are two zero bytes following the word?
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Spocks-cuddly-tribble wrote:Yes, unless you did alter the structure of the systInfo file (i.e. to use entry bytes 0x46&47), so it should be safe to free-up 3 bytes when accessing systInfo+44h(inhabitant-ID) and needing code space.

I do also consider storing [max pop potential] during map generation in such an unused systInfo area, f.e. to improve AI colonisation preferences.
I see, thank you :)

Well, just in case someone needs bytes 0x46 and 0x47, this code should make do without loading those bytes:

Code: Select all

:00467CB4 8B8424F8030000          mov eax, dword[esp+000003F8]   // unchanged
:00467CBB 31C9                    xor ecx, ecx                   // unchanged
:00467CBD 8A4844                  mov cl, byte[eax+44]           // race ID of inhabitants
:00467CC0 0FBF18                  movsx ebx, word[eax]
:00467CC3 8A842414040000          mov al, byte[esp+00000414]     // race ID of attackers
:00467CCA 38C8                    cmp al, cl
:00467CCC 7409                    je 00467CD7
:00467CCE 31D2                    xor edx, edx
:00467CD0 B208                    mov dl, 08                     // ID of morale table entry
Last edited by Gowron on Fri Feb 26, 2010 3:30 pm, edited 1 time in total.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Spocks-cuddly-tribble wrote:Support of more options is always welcome, thanks. :)

PS: Asm address of the je statement looks wrong, but hex seems OK. Maybe an error in ollydbg or whatever you use.

EDIT: Doesn't matter - code needs an update wrt. reconquering (i.e. subjugation) of former native rebel systems anyway...
Indeed, should be 467CD7, thank you for noticing :)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

Spocks-cuddly-tribble wrote:code needs an update wrt. reconquering (i.e. subjugation) of former native rebel systems anyway...
And here it comes:

This option will treat capturing of native rebel systems as subjugation - not as liberation.

Code: Select all

trek.exe at 0x670C4

replace:
31 C0 BA 08 00 00 00 8A 84 24 14 04 00 00 E8 B9 22 FD FF 31 C9 8B 84 24 F8 03 00 00 66 8B 8C 24 14 04 00 00 0F BF 00
with:
8B F3 BA 08 00 00 00 80 78 30 0A 0F B6 84 24 14 04 00 00 8B F8 74 06 3A C1 75 02 B2 0B E8 AA 22 FD FF 8B C6 8B CF 90

AND at 0x67160 change: E8 2B 22 FD FF to: 90 90 90 90 90


467CC4   8BF3               MOV ESI, EBX (system-ID)
467CC6   BA 08000000        MOV EDX, 8
467CCB   8078 30 0A         CMP BYTE [EAX+30], A // if rebel system
467CCF   0FB68424 14040000  MOVZX EAX, BYTE [ESP+414] (attacker-ID)
467CD7   8BF8               MOV EDI, EAX   (attacker-ID)
467CD9   74 06              JE SHORT 467CE1     // subjugation
467CDB   3AC1               CMP AL,CL           // or not native
467CDD   75 02              JNZ SHORT 467CE1    // subjugation
467CDF   B2 0B              MOV DL, B           // else liberation
467CE1   E8 AA22FDFF        CALL 439F90   (morale event)
467CE6   8BC6               MOV EAX, ESI  (system-ID)
467CE8   8BCF               MOV ECX, EDI  (attacker-ID)
467CEA   90                 NOP
(...)
467D60   9090909090         NOP          // old liberation code
(not the most elegant, but shortest replacement code at the moment)

However, there is a minor cosmetic flaw. The popup screen for system attacks (lost ships, OBs...) denotes this case still as rescue effort.

Adapting of the responsible check / jump statement at 46CE98/46CE91 is easy, but unfortunately the needed systInfo[+30 or +4C] data is gone, once subroutine 440BC0 (change system owner) has been called. We could store required info in an unused systInfo byte, as momentary value, but I doubt it's worth the effort to do so.

So I'll leave it as military propaganda among the many other message bugs like "The brutal subjugation of [blank]" :)
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

can i use your new code if i've use gowrons?
or is yours specific to your own modification?
or does it require original code?
or can i use it on either?
thanks.

Spocks-cuddly-tribble wrote:As a general rule, all replacement codes are for (the restored) original code unless explicitly stated otherwise :!:
Post Reply

Return to “Liberating Native Systems (morale error fix)”