MagicLuthee
Member
I'm on a quest to find out how PSO games calculate Section ID.
First step : PSO PC (Done)
Second step : PSOGC (In progress)
Third step : PSOBB
PSO PC Dynamic Analysis with x32dbg (Commented)
First step : PSO PC (Done)
Second step : PSOGC (In progress)
Third step : PSOBB
PSO PC Dynamic Analysis with x32dbg (Commented)
Code:
00461E20 | 56 | push esi | Push esi onto the stack
00461E21 | 8B7424 08 | mov esi,dword ptr ss:[esp+0x8] | Place player name string into ESI
00461E25 | 33C0 | xor eax,eax | Set EAX to 0
00461E27 | 33D2 | xor edx,edx | Set EDX to 0
00461E29 | 8A0E | mov cl,byte ptr ds:[esi] | [A] Place byte value found at the address of ESI into CL (the current character)
00461E2B | 84C9 | test cl,cl | --
00461E2D | 74 0C | je pso.461E3B | Jump to [B] if null character found (if CL == 0)
00461E2F | 0FBEC9 | movsx ecx,cl | Sign-extend CL (make CL 32-bit, preserve sign) move result to ECX
00461E32 | 03C1 | add eax,ecx | Add ECX (value of letter at current pointer) to EAX
00461E34 | 42 | inc edx | Increment EDX by 1 (EDX counts letters in string)
00461E35 | 46 | inc esi | Increment ESI by 1 (ESI points current character in string)
00461E36 | 83FA 0C | cmp edx,0xC | --
00461E39 | 7C EE | jl pso.461E29 | Jump to [A] if letter count < 12
00461E3B | 99 | cdq | [B] Sign extend EAX into EDX (for later)
00461E3C | B9 0A000000 | mov ecx,0xA | Place decimal number 10 in ecx
00461E41 | 5E | pop esi | Place last value that was added to the stack (back at line 1) into ESI and remove it from Stack
00461E42 | F7F9 | idiv ecx | Do signed 32-bit division : EAX / ECX and place quotient in EAX, remainder in EDX
00461E44 | 8BC2 | mov eax,edx | Place remainder into EAX
00461E46 | 85C0 | test eax,eax | --
00461E48 | 7C 04 | jl pso.461E4E | Jump to [C] if EAX Negative (Special use of JL with TEST EAX EAX)
00461E4A | 3BC1 | cmp eax,ecx | --
00461E4C | 7C 02 | jl pso.461E50 | Jump to [D] if EAX > 9
00461E4E | 33C0 | xor eax,eax | [C] Zero out EAX
00461E50 | C3 | ret | [D] Return
Code:
00502140 | 8B4424 04 | mov eax,dword ptr ss:[esp+0x4] | Move result of previous function into EAX
00502144 | 8B0485 38C66900 | mov eax,dword ptr ds:[eax*4+0x69C638] | Get Section ID from table (which starts at 0x69C638)
0050214B | C3 | ret | Return Section ID
Last edited: