Saturday, June 29, 2013

Desperados : Wanted Dead or Alive - Debug String

Inside the binary you can find "debug" strings, which are not related to the game Desperados...
If you know the game "Death Valley" or have more informations please leave a comment, thx.
 C:\\Projets\\Death Valley\\DVArmsTrader.cpp            
 C:\\Projets\\Death Valley\\DVArmsTrader.cpp            
 C:\\Projets\\Death Valley\\DVArtificialBonhomie.cpp        
 C:\\Projets\\Death Valley\\DVArtificialBonhomie.cpp        
 C:\\Projets\\Death Valley\\DVArtificialIntelligence.cpp      
 C:\\Projets\\Death Valley\\DVArtificialIntelligence.cpp      
 C:\\Projets\\Death Valley\\DVArtificialMalignity.cpp       
 C:\\Projets\\Death Valley\\DVArtificialMalignity.cpp       
 C:\\Projets\\Death Valley\\DVBeacon.cpp              
 C:\\Projets\\Death Valley\\DVCampaign.cpp             
 C:\\Projets\\Death Valley\\DVCharacterProfile.cpp         
 C:\\Projets\\Death Valley\\DVCooper.cpp              
 C:\\Projets\\Death Valley\\DVCustomSaveGame.cpp          
 C:\\Projets\\Death Valley\\DVDialogue.cpp             
 C:\\Projets\\Death Valley\\DVDialogue.cpp             
 C:\\Projets\\Death Valley\\DVDoc.cpp               
 C:\\Projets\\Death Valley\\DVDrawManager.cpp           
 C:\\Projets\\Death Valley\\DVDynamicSaveGame.cpp         
 C:\\Projets\\Death Valley\\DVDynamicSaveGame.cpp         
 C:\\Projets\\Death Valley\\DVElement.cpp             
 C:\\Projets\\Death Valley\\DVElementActor.cpp           
 C:\\Projets\\Death Valley\\DVElementActorAnimal.cpp        
 C:\\Projets\\Death Valley\\DVElementActorAnimal.cpp        
 C:\\Projets\\Death Valley\\DVElementActorHorse.cpp        
 C:\\Projets\\Death Valley\\DVElementActorHorse.cpp        
 C:\\Projets\\Death Valley\\DVElementActorHuman.cpp        
 C:\\Projets\\Death Valley\\DVElementActorNPC.cpp         
 C:\\Projets\\Death Valley\\DVElementActorNPC.cpp         
 C:\\Projets\\Death Valley\\DVElementFX.cpp            
 C:\\Projets\\Death Valley\\DVElementMobile.cpp          
 C:\\Projets\\Death Valley\\DVElementObject.cpp          
 C:\\Projets\\Death Valley\\DVElementObject.cpp          
 C:\\Projets\\Death Valley\\DVElementProjectile.cpp        
 C:\\Projets\\Death Valley\\DVElementProjectile.cpp        
 C:\\Projets\\Death Valley\\DVElementTarget.cpp          
 C:\\Projets\\Death Valley\\DVEngine.cpp              
 C:\\Projets\\Death Valley\\DVEngine.cpp              
 C:\\Projets\\Death Valley\\DVFastFindGrid.cpp           
 C:\\Projets\\Death Valley\\DVFastFindGrid.cpp           
 C:\\Projets\\Death Valley\\DVFirearm.cpp             
 C:\\Projets\\Death Valley\\DVFrameHolder.cpp           
 C:\\Projets\\Death Valley\\DVGame.cpp               
 C:\\Projets\\Death Valley\\DVGraphicConfig.cpp          
 C:\\Projets\\Death Valley\\DVGroundMark.cpp            
 C:\\Projets\\Death Valley\\DVHikingGuide.cpp           
 C:\\Projets\\Death Valley\\DVJane.cpp               
 C:\\Projets\\Death Valley\\DVKeyConfig.cpp            
 C:\\Projets\\Death Valley\\DVKung.cpp               
 C:\\Projets\\Death Valley\\DVLine.cpp               
 C:\\Projets\\Death Valley\\DVLoadingScreen.cpp          
 C:\\Projets\\Death Valley\\DVMenu.cpp               
 C:\\Projets\\Death Valley\\DVMinimap.cpp             
 C:\\Projets\\Death Valley\\DVOrder.cpp              
 C:\\Projets\\Death Valley\\DVPatch.cpp              
 C:\\Projets\\Death Valley\\DVPath.cpp               
 C:\\Projets\\Death Valley\\DVPathFinder.cpp            
 C:\\Projets\\Death Valley\\DVPlayerProfileManager.cpp       
 C:\\Projets\\Death Valley\\DVPositionInterface.cpp        
 C:\\Projets\\Death Valley\\DVPowderMark.cpp            
 C:\\Projets\\Death Valley\\DVPowderMark.cpp            
 C:\\Projets\\Death Valley\\DVPsychoanalyst.cpp          
 C:\\Projets\\Death Valley\\DVPsychoanalyst.cpp          
 C:\\Projets\\Death Valley\\DVSanchez.cpp             
 C:\\Projets\\Death Valley\\DVSaveGameManager.cpp         
 C:\\Projets\\Death Valley\\DVScript.cpp              
 C:\\Projets\\Death Valley\\DVSector.cpp              
 C:\\Projets\\Death Valley\\DVSequence.cpp             
 C:\\Projets\\Death Valley\\DVSequenceElement.cpp         
 C:\\Projets\\Death Valley\\DVSequenceManager.cpp         
 C:\\Projets\\Death Valley\\DVSequenceManager.cpp         
 C:\\Projets\\Death Valley\\DVShadowPolygon.cpp          
 C:\\Projets\\Death Valley\\DVSound.cpp              
 C:\\Projets\\Death Valley\\DVSound.cpp              
 C:\\Projets\\Death Valley\\DVSoundCache.cpp            
 C:\\Projets\\Death Valley\\DVSoundCache.cpp            
 C:\\Projets\\Death Valley\\DVSoundCacheEntry.cpp         
 C:\\Projets\\Death Valley\\DVSoundConfig.cpp           
 C:\\Projets\\Death Valley\\DVSoundGeometry.cpp          
 C:\\Projets\\Death Valley\\DVSoundSource.cpp           
 C:\\Projets\\Death Valley\\DVSoundSourceClock.cpp         
 C:\\Projets\\Death Valley\\DVSoundSourceManager.cpp        
 C:\\Projets\\Death Valley\\DVSprite.cpp              
 C:\\Projets\\Death Valley\\DVTitBit.cpp              
 C:\\Projets\\Death Valley\\DVUIRendererAlphaConstantCustom.cpp  
 C:\\Projets\\Death Valley\\DVUIRendererCustom.cpp         
 C:\\Projets\\Death Valley\\DVWill.cpp               
 C:\\Projets\\Death Valley\\Launcher.cpp              
 C:\\Projets\\Death Valley\\SBFramePannelFX.cpp          
 C:\\Projets\\Death Valley\\SBLIBNG\\SBDrawManager.cpp       
 C:\\Projets\\Death Valley\\SBLIBNG\\SBEvent.cpp          
 C:\\Projets\\Death Valley\\SBLIBNG\\SBFile.cpp          
 C:\\Projets\\Death Valley\\SBLIBNG\\SBFont.cpp          
 C:\\Projets\\Death Valley\\SBLIBNG\\SBGeoBoundingBox2D.cpp    
 C:\\Projets\\Death Valley\\SBLIBNG\\SBGeoPoint2D.cpp       
 C:\\Projets\\Death Valley\\SBLIBNG\\SBInput.cpp          
 C:\\Projets\\Death Valley\\SBLIBNG\\SBPicture.cpp         
 C:\\Projets\\Death Valley\\SBLIBNG\\SBResourceManager.cpp     
 C:\\Projets\\Death Valley\\SBLIBNG\\SBThreadedInput.cpp      
 C:\\Projets\\Death Valley\\SBLIBNG\\SBUIInputFieldText.cpp    
 C:\\Projets\\Death Valley\\SBLIBNG\\SBUIRenderer.cpp       
 C:\\Projets\\Death Valley\\SBLIBNG\\SBUIRendererInputField.cpp  
 C:\\Projets\\Death Valley\\SBLIBNG\\SBUIRendererListbox.cpp    
 C:\\Projets\\Death Valley\\SBLibNG/SBWidgetInputField.h      
 C:\\Projets\\Death Valley\\SBProfiler.cpp             
 C:\\Projets\\Death Valley\\dvelementactorpc.cpp          
If you are bored of the MessageBox about the CD, nop this :
 .text:005B5215         push  edi  
 .text:005B5216         call  eax ; dword_693224  

Friday, June 28, 2013

Desperados : Wanted Dead or Alive - Profiles file

This first blog post about the game "Desperados : Wanted Dead or Alive" will describe file format of saved game.
The main file can be found in the directory : "\Data\Savegame" under the name : "Profiles".
All this work was made with version 1.0 of the game.

File format specification :

 +0x00 : Magic Number  
 +0x04 : Version  
 +0x08 : Unknow_00  
 +0x0C : Number of profile's entry  
 +0x10 : Profiles entry  
 ...  

Magic number must be equal to 0x50524F46 ('PROF').
Version in our case is  0x305 (773).
At offset 0x10 start the first profile entry.

CProfile

The constructor of the class CProfile can be found at this address :
 00548EF0 ; void *__thiscall ctor_CProfile(CProfile *this)

The size of this class is 0xBC (188) :
 .text:0054A3BD push  0BCh  
 .text:0054A3C2 call  ??2@YAPAXI@Z  ; operator new  

Method for reading profile entry can be found at this address :
 005496D0 ; char __thiscall ReadProfile(CProfile *this, CFile *a2)  

Profile entry specification :

 +0x00  : Numero of directory entry  
 +0x04  : Current mission  
 +0x08  : Number of mission accomplished  
 +0x0C  : Time elapsed  
 +0x10  : Shortcut config number 1  
 +0xXX  : Shortcut config number 2  
 +0xXX  : Sound configuration  
 +0xXX  : Video configuration  
 +0xXX  : Name of the player  
 +0xXX  : Unknow_00  
 +0xXX  : Number of saved games  
 +0xXX  : Saved game entry  
Method to read profile :
005496D0 ; char __thiscall ReadProfile(CProfile *this, CFile *a2)

Numero of directory entry

Numero of directory entry describe the number of the folder ("Profile_%d") associated with the profile, for example directory "Profile_01", saved game file associated with the profile are saved here.

Shortcut config

Shortcut config is like a serialized class of type CShortcutConfig, the size of this member can change, there is 2 configuration for the shortcuts.
Method to read shortcut configuration :
005105F0 ; char __thiscall ReadProfileShortcutConfig(CShortcutConf *this, CFile *a2)

Sound configuration

Sound configuration is a class of type CSoundConfig :
 00000000 CSoundConf   struc ; (sizeof=0xC)  
 00000000 field_0     dw ?  
 00000002 field_2     dw ?  
 00000004 field_4     dw ?  
 00000006 field_6     dw ?  
 00000008 field_8     dw ?  
 0000000A field_A     db ?  
 0000000B field_B     db ?  
 0000000C CSoundConf   ends  
Method to read sound configuration :
00585D10 ; char __thiscall ReadProfileSoundConfig(CSoundConf *this, CFile *a2)

Video configuration is a class of type CVideoConfig :

 00000000 CVideoConf   struc ; (sizeof=0xC)  
 00000000 Animation    db ?  
 00000001 Shadow     db ?  
 00000002 Angle      db ?  
 00000003 Effect     db ?  
 00000004 CResolution   CVideoReso ?  
 0000000C CVideoConf   ends  
 0000000C  
 00000000 ; -----------------------------------  
 00000000  
 00000000 CVideoReso   struc ; (sizeof=0x8)  
 00000000 reso_X     dd ?  
 00000004 reso_Y     dd ?  
 00000008 CVideoReso   ends  
Method to read video configuration :
0050CBE0 ; char __thiscall ReadProfileVideoConfig(CVideoConf *this, CFile *a2)

Name of player

Name of player is stored under a structure :
 +0x00 : SizeName  
 +0x04 : wchar_t [SizeName]  

Then come the number of saved games, and entry of each saved game.

CFile

And for those wondering about the class CFile :
00000000 CFile           struc ; (sizeof=0x58)
00000000 stream          dd ?                    ; offset
00000004 mode_read       dd ?
00000008 SizeFile        dd ?
0000000C field_C         dd ?
00000010 ArchiveVersion  dd ?
00000014 error_status    dd ?
00000018 field_18        CString ?
00000028 field_28        dd ?
0000002C field_2C        dd ?
00000030 field_30        dd ?
00000034 field_34        dd ?
00000038 field_38        dd ?
0000003C field_3C        dd ?
00000040 lpCreationTime  _FILETIME ?
00000048 lpLastAccessTime _FILETIME ?
00000050 lpLastWriteTime _FILETIME ?