Wow, great Stuff
Do you think it could be possible to export all that information to created a Blender movie from replays?
Do you think it could be possible to export all that information to created a Blender movie from replays?
Herr Otto Partz says you're all nothing but pipsqueaks!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Daniel3D on October 30, 2022, 11:49:25 AMThere are a lot of them (if i read correctly)
Is it possible to redo it while maintaining the labels and comments that are made?
Quotesadly that feature can't be reverted
Quote from: llm on October 16, 2022, 03:41:54 PMim currently a little bit confused about the current state of some functions in the asmorig - some of the functions you've showed me are full of unused labels, messing the asm code a little
these labels do not exists if i freshly analyze the current game exe with IDA - need to find out what these labels are for
Quote from: Daniel3D on October 20, 2022, 09:43:28 AMQuote from: llm on October 16, 2022, 03:41:54 PMim currently a little bit confused about the current state of some functions in the asmorig - some of the functions you've showed me are full of unused labels, messing the asm code a little
these labels do not exists if i freshly analyze the current game exe with IDA - need to find out what these labels are for
The code has things that even i find strange, like in seg000:loc_143BB:
cmp ax, 4D00h
[u]jnz short loc_143C3[/u]
jmp loc_144A4
loc_143C3:
jmp loc_14188
loc_143C6:
cmp [bp+var_selectedmenu], 0
jnz sh
I guess this could be written as:loc_143BB:
cmp ax, 4D00h
jnz short loc_14188 ;loc_143C3
jmp loc_144A4
;loc_143C3:
;jmp loc_14188
loc_143C6:
cmp [bp+var_selectedmenu], 0
jnz sh
QuoteIt was my first 3d game and I made many mistakes
... For this reason the number of arguments is not appended to the name of the function by the compiler, and the assembler and the linker are therefore unable to determine if an incorrect number of arguments is used...
Quote from: Daniel3D on October 17, 2022, 11:10:32 AMIs this kind of optimization the reason that it is difficult to reverse assembly back to C? (after it is assembled, compiled, decompiled, disassembled and converted to C) I probably have the steps wrong or mixed but (again >) you know what I mean.![]()
Quote from: Daniel3D on October 17, 2022, 10:36:21 AMIs it possible to "fix" these functions with your disassembled code. (I still have to process the rest of the code, maybe i can do that Wednesday or Friday). If both versions create a bit perfect assembly then they should be interchangeable right?
Quote from: Daniel3D on October 17, 2022, 10:55:35 AMI kinda get what you mean, but this is a few steps too advanced for me. I don't really know how memory stacking works. I have a vague impression, but that is part literal and part logical and most likely a big part wrong..![]()
push 1
push 2
push 3
pop ax => 3
pop bx => 2
pop cx => 1
seg016:0008 push [bp+arg_4] ; 2 byte push - parameter 2
seg016:000B push [bp+arg_2] ; 2 byte push - parameter 1
seg016:000E push [bp+arg_0] ; 2 byte push - parameter 0
seg016:0011 call sub_30F9D
seg016:0016 add sp, 6 ; 3*2
seg016:0002 locate_many_resources proc far ; CODE XREF: load_intro_resources+2A␘P
seg016:0002 ; run_opponent_menu+4A␘P
seg016:0002 ; load_skybox+60␘P
seg016:0002 ; load_sdgame2_shapes+2C␘P
seg016:0002 ; setup_intro+2E␘P
seg016:0002 ; setup_car_shapes+9C␘P
seg016:0002 ; setup_car_shapes+B4␘P
seg016:0002 ; setup_car_shapes+D3␘P
seg016:0002 ; loop_game+34␘P
seg016:0002 ; load_tracks_menu_shapes:loc_2A2E3␘P
seg016:0002 ; load_tracks_menu_shapes:loc_2A2F9␘P
seg016:0002 ; load_tracks_menu_shapes+53␘P
seg016:0002
seg016:0002 arg_0 = word ptr 6
seg016:0002 arg_2 = word ptr 8
seg016:0002 arg_4 = word ptr 0Ah
seg016:0002 arg_6 = word ptr 0Ch
seg016:0002
seg016:0002 push bp
seg016:0003
seg016:0003 loc_367B3:
seg016:0003 mov bp, sp
seg016:0005
seg016:0005 loc_367B5:
seg016:0005 jmp short loc_367D9
seg016:0005 ; ---------------------------------------------------------------------------
seg016:0007 align 2
seg016:0008
seg016:0008 loc_367B8: ; CODE XREF: locate_many_resources+2D␙j
seg016:0008 push [bp+arg_4]
seg016:000B
seg016:000B loc_367BB:
seg016:000B push [bp+arg_2]
seg016:000E
seg016:000E loc_367BE:
seg016:000E push [bp+arg_0]
seg016:0011
seg016:0011 loc_367C1:
seg016:0011 call locate_shape_fatal
seg016:0016
seg016:0016 loc_367C6:
seg016:0016 add sp, 6
seg016:0019
seg016:0019 loc_367C9:
seg016:0019 mov bx, [bp+arg_6]
seg016:001C
seg016:001C loc_367CC:
seg016:001C add [bp+arg_6], 4
seg016:0020
seg016:0020 loc_367D0:
seg016:0020 mov [bx], ax
seg016:0022 mov [bx+2], dx
seg016:0025 add [bp+arg_4], 4
seg016:0029
seg016:0029 loc_367D9: ; CODE XREF: locate_many_resources:loc_367B5␘j
seg016:0029 mov bx, [bp+arg_4]
seg016:002C
seg016:002C loc_367DC:
seg016:002C cmp byte ptr [bx], 0
seg016:002F jnz short loc_367B8
seg016:0031 pop bp
seg016:0032 retf
seg016:0032 locate_many_resources endp
seg016:0002 sub_367B2 proc far ; CODE XREF: sub_10786+2A␘P
seg016:0002 ; sub_1293C+4A␘P ...
seg016:0002
seg016:0002 arg_0 = word ptr 6
seg016:0002 arg_2 = word ptr 8
seg016:0002 arg_4 = word ptr 0Ah
seg016:0002 arg_6 = word ptr 0Ch
seg016:0002
seg016:0002 push bp
seg016:0003 mov bp, sp
seg016:0005 jmp short loc_367D9
seg016:0005 ; ---------------------------------------------------------------------------
seg016:0007 nop
seg016:0008
seg016:0008 loc_367B8: ; CODE XREF: sub_367B2+2D␙j
seg016:0008 push [bp+arg_4]
seg016:000B push [bp+arg_2]
seg016:000E push [bp+arg_0]
seg016:0011 call sub_30F9D
seg016:0016 add sp, 6
seg016:0019 mov bx, [bp+arg_6]
seg016:001C add [bp+arg_6], 4
seg016:0020 mov [bx], ax
seg016:0022 mov [bx+2], dx
seg016:0025 add [bp+arg_4], 4
seg016:0029
seg016:0029 loc_367D9: ; CODE XREF: sub_367B2+3␘j
seg016:0029 mov bx, [bp+arg_4]
seg016:002C cmp byte ptr [bx], 0
seg016:002F jnz short loc_367B8
seg016:0031 pop bp
seg016:0032 retf
seg016:0032 sub_367B2 endp
Quote from: Daniel3D on October 16, 2022, 06:23:19 PMCan it be that the ida has mistaken them for labels and that they are just values?
Quote from: Daniel3D on October 16, 2022, 06:23:19 PMI don't know how much the ida has evolved since the first disassembly. Also from what I've read about the process I have a feeling that you have a bit more experience with this. So maybe your settings create a cleaner result..
Quote from: Daniel3D on October 16, 2022, 06:23:19 PMThat would be unfortunate because that would mean that it is smart to redo the entire process. And there has been done a lot of research and analyzing that has to be copied and checked.
Quote from: Daniel3D on October 16, 2022, 03:28:12 PMThank you. That really makes it clearer. I kind of deducted the functionality but this is a lot more detailed.
Quote from: Daniel3D on October 16, 2022, 03:28:12 PMMy guess is that if the non symbolic offsets are fixed and the para alignment (do i say that correctly? You know what I mean) is done. Then it may be very easy to expand the horizons.
Quote from: Daniel3D on October 15, 2022, 10:44:16 PM*Learned that form CAS.
seg003:38BC mov al, [bp+arg_0] <-- al = arg0
seg003:38BF mov byte_46167, al
seg003:38C2 mov byte_3B8F6, 1
seg003:38C7 cbw <== ax = signe-extended(al)
seg003:38C8 mov cx, ax
seg003:38CA shl ax, 1
seg003:38CC shl ax, 1
seg003:38CE shl ax, 1
seg003:38D0 add ax, cx
seg003:38D2 add ax, offset aDesert ; "desert"
seg003:38D5 push ax <-- first parameter of file_load_shape2d_fatal_thunk
seg003:38D6 call file_load_shape2d_fatal_thunk
dseg:0140 aDefault db 'DEFAULT',0
dseg:0148 db 0
dseg:0149 db 0
==> table with 5, 8+1 byte strings
dseg:014A aDesert db 'desert',0,0,0 ; DATA XREF: sub_1D7A2+40␘o
dseg:0153 aTropical db 'tropical',0
dseg:015C aAlpine db 'alpine',0,0,0
dseg:0165 aCity db 'city',0,0,0,0,0
dseg:016E aCountry db 'country',0,0
so in C that would be "char[9] background[5]" and arg0 is then 0-4
dseg:0177 db 0
dseg:0178 db 0
dseg:0179 db 0
using background_name_t = char[9];
const background_name_t background_names[5] // the missing 0 is implicitly added due to beeing a c-string and a global var
{
"desert",
"tropical",
"alpine",
"city",
"country"
};
file_load_shape2d_fatal_thunk(background_names[arg0]);
ax = 9 * cbw(arg0) + offset aDesert
push ax
call file_load_shape2d_fatal_thunk
#include <string.h>
typedef char background_name_t[9];
const background_name_t background_names[5] =
{
"desert",
"tropical",
"alpine",
"city",
"country"
};
int main(int argc, char* argv[])
{
return strlen(background_names[argc]);
}
seg000:0010 ; int __cdecl main(int argc, const char **argv, const char **envp)
seg000:0010 _main proc near ; CODE XREF: start+8D␙p
seg000:0010
seg000:0010 arg_0 = word ptr 4
seg000:0010
seg000:0010 push bp
seg000:0011 mov bp, sp
seg000:0013 xor ax, ax
seg000:0015 call __chkstk
here is your original assembler code (ignoring cbw) as a result from my C/C++ code
seg000:0018 mov ax, [bp+arg_0]
seg000:001B mov cx, ax
seg000:001D shl ax, 1
seg000:001F shl ax, 1
seg000:0021 shl ax, 1
seg000:0023 add ax, cx
seg000:0025 add ax, offset aDesert ; "desert"
seg000:0028 push ax ; char *
seg000:0029 call _strlen
seg000:002C add sp, 2
seg000:002F pop bp
seg000:0030 retn
seg000:0030 _main endp
dseg:003C db 43h ; C
dseg:003D db 6Fh ; o
dseg:003E db 72h ; r
dseg:003F db 70h ; p
dseg:0040 db 11h
dseg:0041 db 0
dseg:0042 aDesert db 'desert',0 ; DATA XREF: _main+15␘o
dseg:0049 db 0
dseg:004A db 0
dseg:004B db 74h ; t
dseg:004C db 72h ; r
dseg:004D db 6Fh ; o
dseg:004E db 70h ; p
dseg:004F db 69h ; i
dseg:0050 db 63h ; c
dseg:0051 db 61h ; a
dseg:0052 db 6Ch ; l
dseg:0053 db 0
dseg:0054 db 61h ; a
dseg:0055 db 6Ch ; l
dseg:0056 db 70h ; p
dseg:0057 db 69h ; i
dseg:0058 db 6Eh ; n
dseg:0059 db 65h ; e
dseg:005A db 0
dseg:005B db 0
dseg:005C db 0
dseg:005D db 63h ; c
dseg:005E db 69h ; i
dseg:005F db 74h ; t
dseg:0060 db 79h ; y
dseg:0061 db 0
dseg:0062 db 0
dseg:0063 db 0
dseg:0064 db 0
dseg:0065 db 0
dseg:0066 db 63h ; c
dseg:0067 db 6Fh ; o
dseg:0068 db 75h ; u
dseg:0069 db 6Eh ; n
dseg:006A db 74h ; t
dseg:006B db 72h ; r
dseg:006C db 79h ; y
dseg:006D db 0
dseg:006E db 0
dseg:006F db 0
dseg:0070 word_105D0 dw 0 ; DATA XREF: start+4A␘w
Quote from: llm on October 14, 2022, 01:56:05 PMThere is a function that loads horizons. That function gets its filenames from Dseg.