Search In
• More options...
Find results that contain...
Find results in...

# [Sanny] Custom Edit Modes

## Recommended Posts

I'm working towards building custom edit modes that can support SA PS2 and mobile versions for III and VC, but first I wanted to bring my SA Mobile mode up to speed with PC, and that means finally straightening out the global variable names.

SA Mobile - Standard Files v3.2.2

SASCM.ini - opcode processing

opcodes.txt - Opcode Search text

custom.dat - loads IDE files for model ID numbers

CustomVariables.ini - Format option: Custom Variable names
keywords.txt - shortcuts for common opcodes
missions.txt - original mission names option
american.gxt - standard file, adds comment strings for GXT keys

130.bin
137.bin

debug.bin

classes.db

SA Mobile - Test Files

SASCM.ini - CleoA update

opcodes.txt - CleoA update

custom.dat - with IDE lines from default.dat and gta.dat (see below)

data\

default.dat
default.ide
gta.dat
peds.ide
txdcut.ide
vehicles.ide
maps\*\ *.IDE

CustomVariables.ini - matching all common Variable names with PC

CustomLabels.ini - matching Labels with PC

CustomArrays.ini - matching Arrays with PC

american.gxt - looks like this file gets updated with patches
keywords.txt
missions.txt
130.bin
137.bin

debug.bin

classes.db

CustomArrays,ini

802  12 Girl_Weapons
1219 8 Airport_Gates

custom.dat

This is just the IDE lines taken from default.dat and gta.dat. These could be read automatically if SA Mobile's game directory is set to Sanny's data\SA Mobile folder, but that seems like an awkward place to sync my compiled and copied scripts. And these files seem more appropriate under the custom edit mode folder anyway.

Update: Since SA Mobile doesn't Compile + Copy it would probably be easier to simply set the game folder to Sanny's edit mode's data folder and manage file copying manually than trying to manage a custom.dat file..

### DEFAULT.DAT ###
# Object types
#
IDE DATA\DEFAULT.IDE
IDE DATA\VEHICLES.IDE
IDE DATA\PEDS.IDE

### GTA.DAT ####
# Object types
#
IDE DATA\MAPS\generic\vegepart.IDE
IDE DATA\MAPS\generic\barriers.IDE
IDE DATA\MAPS\generic\dynamic.IDE
IDE DATA\MAPS\generic\dynamic2.IDE
IDE DATA\MAPS\generic\multiobj.IDE
IDE DATA\MAPS\generic\procobj.IDE
IDE DATA\MAPS\LA\LAn.IDE
IDE DATA\MAPS\LA\LAn2.IDE
IDE DATA\MAPS\LA\LAs.IDE
IDE DATA\MAPS\LA\LAs2.IDE
IDE DATA\MAPS\LA\LAe.IDE
IDE DATA\MAPS\LA\LAe2.IDE
IDE DATA\MAPS\LA\LAw2.IDE
IDE DATA\MAPS\LA\LAw.IDE
IDE DATA\MAPS\LA\LAwn.IDE
IDE DATA\MAPS\LA\LAhills.IDE
IDE DATA\MAPS\LA\LAxref.IDE
IDE DATA\MAPS\SF\SFn.IDE
IDE DATA\MAPS\SF\SFs.IDE
IDE DATA\MAPS\SF\SFse.IDE
IDE DATA\MAPS\SF\SFe.IDE
IDE DATA\MAPS\SF\SFw.IDE
IDE DATA\MAPS\SF\SFxref.IDE
IDE DATA\MAPS\vegas\vegasN.IDE
IDE DATA\MAPS\vegas\vegasS.IDE
IDE DATA\MAPS\vegas\vegasE.IDE
IDE DATA\MAPS\vegas\vegasW.IDE
IDE DATA\MAPS\vegas\vegaxref.IDE
IDE DATA\MAPS\country\countryN.IDE
IDE DATA\MAPS\country\countN2.IDE
IDE DATA\MAPS\country\countryS.IDE
IDE DATA\MAPS\country\countryE.IDE
IDE DATA\MAPS\country\countryW.IDE
IDE DATA\MAPS\country\counxref.IDE
IDE DATA\MAPS\interior\int_LA.IDE
IDE DATA\MAPS\interior\int_SF.IDE
IDE DATA\MAPS\interior\int_veg.IDE
IDE DATA\MAPS\interior\int_cont.IDE
IDE DATA\MAPS\leveldes\levelmap.IDE
IDE DATA\MAPS\leveldes\levelxre.IDE
IDE DATA\MAPS\interior\gen_int1.IDE
IDE DATA\MAPS\interior\gen_int2.IDE
IDE DATA\MAPS\interior\gen_intb.IDE
IDE DATA\MAPS\interior\gen_int3.IDE
IDE DATA\MAPS\interior\gen_int4.IDE
IDE DATA\MAPS\interior\gen_int5.IDE
IDE DATA\MAPS\interior\savehous.IDE
IDE DATA\MAPS\leveldes\seabed.IDE

# interiors
IDE DATA\MAPS\interior\props.IDE
IDE DATA\MAPS\interior\props2.IDE
IDE DATA\MAPS\interior\propext.IDE

IDE DATA\MAPS\veh_mods\veh_mods.IDE

# txd parents
IDE DATA\TXDCUT.IDE

The data\maps\ files are contained within main.8.com.rockstargames.gtasa.obb. Rename a copy of the file to a zip extension to extract. patch.8.com.rockstargames.gtasa.obb holds the files from the \data directory.

Update: I ran WinMerge on my IDE files for PC and SA Mobile and the files are nearly identical. The only differences are to a handful of draw distance figures. The object IDs are all the same, which suits this purpose nicely. PCv1 and PCv2 are identical. I know from previous experience that many of the PS2 object IDs don't always match with PC.

american.gxt seems to be locked away in an APK file somewhere. I'm still not sure how to get at it.

Cleo for Android Opcodes and Text

SASCM.ini supplement - append to the end of file.

0DD0=2,%1d% = get_label_addr %2p% ; android
0DD1=2,%1d% = get_func_addr_by_cstr_name %2d% ; android
0DD2=1,context_call_func %1d% ; android
0DD3=2,context_set_reg %1d% value %2d% ; android
0DD4=2,%1d% = context_get_reg %2d% ; android
0DD6=1,%1d% = get_game_version ; android
0DD7=1,%1d% = get_image_base ; android
0DD9=5,write_mem_addr %1d% value %2d% size %3d% add_ib %4d% protect %5d% ; android
0DDC=2,set_mutex_var %1d% to %2d% ; android
0DDD=2,%1d% = get_mutex_var %2d% ; android
0DE0=3,%1d% = get_touch_point_state %2d% mintime %3d% ; android
0DE1=5,%1d% = get_touch_slide_state from %2d% to %3d% mintime %4d% maxtime %5d% ; android
0DE3=2,%1d% = get_menu_button_pressed mintime %2d% ; read opcode info before using ; android

opcode.txt supplement - append, no need to sort

0DD0: [email protected] = get_label_addr @label ; android
0DD1: [email protected] = get_func_addr_by_cstr_name "test" ; android
0DD3: context_set_reg [email protected] value 5 ; android
0DD4: [email protected] = context_get_reg [email protected] ; android
0DD6: [email protected] = get_game_version ; android
0DD7: [email protected] = get_image_base ; android
0DDC: set_mutex_var 1 to 5 ; android
0DDD: [email protected] = get_mutex_var 3 ; android
0DE0: [email protected] = get_touch_point_state [email protected] mintime [email protected] ; android
0DE1: [email protected] = get_touch_slide_state from [email protected] to [email protected] mintime [email protected] maxtime [email protected] ; android
0DE2: [email protected] = get_menu_button_state ; read opcode info before using ; android
0DE3: [email protected] = get_menu_button_pressed mintime [email protected] ; read opcode info before using ; android

Edited by OrionSR
Code Tags

##### Share on other sites

New Edit Mode - SA PCv2

I've been experimenting with new edit modes with some unexpected results, but I figured I'd cover an easy one before wrestling with some new ideas. San Andreas Version 2 for PC is almost the same as v1. The major difference for Sanny is that the custom label offsets are different. CustomLabels_v2.ini is already provided standard, so this is basically a copy and paste operation.

Copy Sanny's data\sa folder to data\sapcv2

Rename CustomLabels.ini to CustomLabel_v1.ini

Rename CustomLabels_v2.ini to CustomLabel.ini

* You can also change the <variables> file used in games.xml, but I kept editing the wrong file.

Open games.xml located in Sanny's data folder.

Append this edit mode just before </games> at the end of the file.

   <game shortcut="PCv2" title="SAPCv2" mode="sa" type="">
<data>@sb:\data\sapcv2\</data>
<opcodes>@sb:\data\sapcv2\SASCM.ini</opcodes>
<classes>@sb:\data\sapcv2\classes.db</classes>
<variables>@sb:\data\sapcv2\CustomVariables.ini</variables>
<keywords>@sb:\data\sapcv2\keywords.txt</keywords>
<labels>@sb:\data\sapcv2\CustomLabels.ini</labels>
<arrays>@sb:\data\sapcv2\CustomArrays.ini</arrays>
<missions>@sb:\data\sapcv2\missions.txt</missions>
</game>

Save the changes and (re)start Sanny. The new edit mode should be available on the list in the lower right corner.

Edited by OrionSR
Code Tags

##### Share on other sites

Unexpected - Quirks of Sanny's Edit Modes

Maybe I'm just not thinking about this correctly, but what I hoped to accomplish isn't as easy as I had hoped. This is a collection of notes and frustrations.

Mandatory Game Folder: Sanny insists or setting a game folder for each edit mode. With the SA Mobile edit mode all self-contained nothing should need to be read from this folder, and nothing would get written to this folder in SA Mobile mode anyway.

No Custom.dat for SA Mode: I wanted to make a self-contained PC edit mode, for a laptop without the full game for example, but can't use custom.dat to specify where to look for data fies using the standard "sa" mode.

No Compile + Copy in SA Mobile Mode: When I switched my self-contained PC edit mote to SA_Mobile to take advantage of custom.dat I lost the ability to use compile and copy to a sync or cloud folder.

File comparison of the IDE files of PCv1. PCv2, and SA Mobile show these files are nearly identical. Only a few draw distance values have been increased in Mobile, the ID values are the same. So rather than maintain a separate IDE archive for each version I'm looking for ways to share the data files. Setting the game folder to a single archive is the easy strategy for now, and avoids all the hassle of editing the paths in a custom.dat file.

<data>@sb:\data\sapctest\data\</data>

I was hoping this line in games.xml would let me specify a data folder for IDE and DAT files but so far opcode.txt is the only file I can find that reads from that folder. It looks like the other Sanny files have specific lines of their own anyway.

It's starting to look like the easiest way to manage the IDE files is to simply set the game folder as required and skip managing custom.dat altogether. It doesn't really matter if I use "sa" mode or "sa_mobile" as I'll need to manage my scripts manually.

I think what would help the most is a way to separate the compile and copy folders from the data folder to be read. A system that worked well for PC only doesn't quite fit the strategies needed for managing multiple systems and edit modes.

So with than in mind I think I'll skip trying to post new edit modes for now. I'm not sure how I want to use the tools I have available. My PS2 disks just finished copying so I'll run a compare tool on the IDE files and see how different they really are. Then I'll see if I can crank out a few CustomVariable.ini ports.

IDE File Comparison

PCv1, PCv2 and Android: Identical ID numbers, slight differences in many mobile draw distance values.
PS2v1 and PS2v2: Identical except for significant changes to VEGASE.IDE

PCv2 and PS2v2:

data\ all identical including default.ide, peds.ide and vehicles.ide
data\maps\veh_mods\veh_mods.ide identical
data\maps\generic\ identical except for a flag in dynamic.ide
data\maps\interior\ prop*.ide have flag changes, stadint.ide is identical

Otherwise, some match, others don't, and the changes are often significant.

Edited by OrionSR

##### Share on other sites

Edit Mode - San Andreas PS2v1

I suspect that not many people are likely to use PS2 edit modes but here they are anyway.

Both edit modes are sa so set the game directory to the edit mode folder,

Or change the mode to sa_mobile and move american.gxt to the edit mode root.

CustomArrays.ini - no change needed from PC

sascm.ini and opcodes.txt - strip all cleo opcodes

Edit Mode - San Andreas PS2v2

CustomArrays.ini

807  12 Girl_Weapons
1199 8 Airport_Gates

sascm.ini and opcodes.txt - strip all cleo opcodes

sascm.ini - add opcode 0A4F: (unknown, seen in PS2v2 and Xbox)

0A4F=0,unknown

I won't be able to put together a considered Edit Mode for GTA3 anytime soon, but I made significant progress of porting the full "original" variable name list from PC to Android. When Sanny is set with local offsets and matching GXT files I get a very high degree of correspondence when comparing decompiling results using WinMerge.

The rather incomplete variable lists for San Andreas make direct comparison rather difficult. I'm not sure how to increase my confidence in the conversion without rounding out the SA variable list considerably. When I pick up this project again I'm hoping to start naming things based on the conventions used in GTA3.

Edited by OrionSR
Code Tags

##### Share on other sites

Edit modes got many enhancements recently so this topic needs an update.

##### Share on other sites
On 8/26/2020 at 8:51 PM, Seemann said:

Edit modes got many enhancements recently so this topic needs an update.

Yeah it does. I've been working on updating my custom edit modes with the new enhancements and will attempt to blog my progress.

A good place to start is with a GTA Script Archive which includes all the main.scm files for each version that I've been able to identify.

Game versions included in this archive:

GTA3

• Steam - all PC
• PS2
• iOS
• ARM - Android

Vice City

• Steam - all PC
• PS2
• ARM - Android

San Andreas PC

• PCv1
• PCv2
• Steam - same as PCv2

San Andreas PS2

• PS2v1
• PS2v2 - same as PS4
• PS2_JP1 - Japan v1

San Andreas Mobile (mobile versions are save compatible between iOS, Android and WinStore)

•  iOS - early unknown version
• APK103 - Android
• APK105 - Android
• APK106 - Android
• APK107 - Android
• APK108 - Android (previous long-lived release)
• APK200 - Android
• WinStore

San Andreas Remastered

• WinStore - unused
• PS3
• Xbox360 - same as Xbox One?

Liberty City Stories

• PS2
• PSP

Vice City Stories

• PS2
• PSP

If anyone would like to offer original scripts for versions not included in this archive, I also need some additional files to support an edit mode. I'm looking for everything in the DATA and TEXT folders. What I need are the DAT and IDE files in DATA and MAPS, and american.gxt from TEXT, but the other files are nice to include in a larger reference archive.

Edited by OrionSR

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×