Rebellions & the message withdrawn bug (fix)

Rebellions & the message withdrawn bug (fix); support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 723
Joined: Sun Apr 27, 2008 2:00 am

Rebellions & the message withdrawn bug (fix)

Post by Spocks-cuddly-tribble » Tue Oct 13, 2009 11:29 am

Another teamwork by DCER & me. :)
DCER wrote:There's a bug in botf that when a minor has been conquered and then freed itself on it's own through rebellion, no empire can any longer send proposals to it. Only gifts.

If you send a proposal you'll get two entries in your report saying you withdrew the proposal.
As DCER pointed out here, the entry at [alienInfo+3C] won't be updated when subjugated minor races shake off slavery via rebellion.

Internal code for rebellion is 0x1000000 & 0x1C0000, set in loc_4402DF as a possible result of insufficient morale.

Confusingly enough, it seems next to impossible (due to a bug?) that minors rebel if random events = off. :?

So the fix requires manipulation of random event code (loc_44BB66):

EDIT: Code outdated ! see below

Code: Select all

trek.exe at 0x4AF9E

change:
83 0F FF FF FF 66 83 FA 20 0F 83 A2 00 00 00 89 D1 BA 01 00 00 00 D3 E2 8B 2D 50 2B 5A 00 89 D1 21 E9 0F 85
to:
82 0F FF FF FF C1 E2 06 81 C2 4C 20 5A 00 C6 02 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E9


asm-44BB9D:
jb      loc_44BAB2
shl     edx, 6
add     edx, offset_alienInfo+3C
mov     byte ptr [edx], 0
nop     (...)
jmp     loc_44BAB2
This code worked fine during my tests, but more testing would be wise. :wink:


Note this random events - button bug (options) when testing, otherwise it might be that pseudo-inconsistencies send you into the psychiatry. :x
Last edited by Spocks-cuddly-tribble on Sat Dec 11, 2010 7:38 am, edited 2 times in total.
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust » Tue Oct 13, 2009 12:06 pm

Right, sorry to drag you all down to my level of idiocy, but am I right in saying this code change would then allow you to successfully enter diplomatic relations with a rebelled minor race?
Spocks-cuddly-tribble wrote:Yes it does, but not afterwards!
Computers! [Expletive deleted]

My 4shared folder

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 723
Joined: Sun Apr 27, 2008 2:00 am

minor race rebelled / message withdrawn Bug(fix) - UPDATE

Post by Spocks-cuddly-tribble » Thu Feb 25, 2010 4:16 pm

minor race rebelled / message withdrawn Bug(fix) - UPDATE


My above code disables this sequence (to restore original code see above):

IF inhabitant empire alive THEN set inhabitant-bit at [esp] // (maybe for rejoin message)


The following code keeps fix and doubtful code + more options for editing of random events:


Sub_4403D0 (rebellion_effects) loc_44054E:

Code: Select all

trek.exe at 0x3F94E

replace:
66 8B 45 44 66 3D 05 00 72 47 66 3D 23 00 77 41 31 C0 66 8B 45 44

with:
0F B7 45 44 3C 05 72 49 8B C8 C1 E1 06 81 C1 4C 20 5A 00 C6 01 00


44054E    0FB745 44       movzx  eax, word [ebp+44h]
440552    3C 05           cmp    al, 5
440554    72 49           jb     short 44059F
440556    8BC8            mov    ecx, eax
440558    C1E1 06         shl    ecx, 6
44055B    81C1 4C205A00   add    ecx, offset alienInfo+3C
440561    C601 00         mov    byte [ecx], 0

On this occasion we prepare subroutine 4403D0 for rebellions even if the inhabitant empire is dead (without restoring source empire). By default it's impossible and causes a partial freeze of random events on such systems. :?


IF inhabitant empire dead THEN jump to code for native rebellions (i.e. create independent rebel system):

Code: Select all

trek.exe at 0x3F885 change 89 to -> 9D

at 0x3FA2B change 89 F1 to -> 8B CA

at 0x3FA39 change 0F 85 9C FE FF FF to -> 8A 45 4C 75 62 90


440483   JB 440626 (skip redundant / keep ESI)

44062B   MOV ECX, EDX

440639   MOV AL, [ebp+4Ch]
44063C   JNZ SHORT 4406A0 (native rebellion sequence)
44063E   NOP
Note BotF still prevents this from happening. But I contrive enabling this feature at one go with an upcoming seperation of rebellions and random events (soon). :)

[EDIT:]

for the default random event code (sub_44C04C) this should work (f.e.):

44C0FF jmp short 44C132 // at 0x4B4FF change 73 to -> EB
44C23F jmp short 44C260 // at 0x4B63F change 73 to -> EB

for the low-morale penalties (sub_43FB90 - rebellion part starting at 43FD41):

43FD78 jmp 4402DF // at 0x3F178 change 0F 83 to -> 90 E9
Last edited by Spocks-cuddly-tribble on Sat Dec 11, 2010 7:40 am, edited 2 times in total.
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 723
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble » Tue Mar 09, 2010 1:31 pm

Well, I finally found some time to test this.

Observations:

1. The above fix for rebellions of dead empire inhabitant systems works flawless. :)

2. Rebellions are possible even without random events, but much rarer and with corrupted messages i.e. "[blank] declares independence from [blank]" (this can be solved).

Note only the updated minor-rebellion fix works even in this case.


Testing with an empire consisting of 10 systems of all possible sorts (home, additional starting, self colonised, free & conquered minor, conquered major/dead+alive & conquered home) - keeping all systems at rebellious morale for 100 turns - I got just barely 2 rebellions without random events (by way of comparison: with random events ~2 per turn).

Also there appears to be a delay (~75 turns/ if not coincidence) and sporadic event accumulations regarding the low morale code. :?

Until both issues are researched properly, the planned seperation of the rebellions from random events i.e. adjusting structure and frequencies of subroutine 43FB90 (low-morale penalties), is on hold.


This solves the corrupted message issue:

(replacement example taken from random events code at 44C132 & 44C26F)

Code: Select all

trek.exe at 0x3F6DF

change:
8B 44 24 2E C1 F8 10 BA 00 00 1C 00 E8 E0 00 00 00 89 F8 E8 C9 8E 01 00 BA 00 00 00 01 89 F8 E8 ED 8E 01 00 31 C0 31 D2 8A 46 4C
to:
6A FF B8 00 00 00 01 0F BF 1E B9 FE FF FF FF 0F B6 56 4C 80 8E 07 03 00 00 01 E8 82 B7 00 00 0F BF 06 E8 CA 00 00 00 EB 32 90 90


4402DF     6A FF              PUSH -1
4402E1     B8 00000001        MOV EAX, 1000000 =rebellion event code
4402E6     0FBF1E             MOVSX EBX, WORD [ESI] =system ID
4402E9     B9 FEFFFFFF        MOV ECX, -2
4402EE     0FB656 4C          MOVZX EDX, BYTE [ESI+4C] =ex-owner ID
4402F2     808E 07030000 01   OR BYTE [ESI+307], 1
4402F9     E8 82B70000        CALL 44BA80 (prepare event message/list)
4402FE     0FBF06             MOVSX EAX, WORD [ESI] =system ID
440301     E8 CA000000        CALL 4403D0 (rebellion effects)
440306     EB 32              JMP SHORT 44033A (exit)
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

Post Reply

Return to “Rebellions & the message withdrawn bug (fix)”

Who is online

Users browsing this forum: No registered users