[PC FF7 2012] FF7 ReRelease IPC (Inter-Process Communication)

  • Thread starter Thread starter dziugo
  • Start date Start date
Status
Not open for further replies.
D

dziugo

Guest
IPC Description

Shared memory is used for sending data between Launcher and FF7 (CreateFileMapping -> MapViewOfFile):
Code: [Select]
Code:
ff7_sharedMemoryWithLauncher - name of the shared memory resource.
Notes: The size of the shared block is 0x20000 bytes in length. First 0x10000 bytes are for Game->Launcher traffic (G2L), following 0x10000 bytes are for Launcher->Game traffic (L2G).

Semaphores are used for synchronizing traffic between Launcher and FF7 (CreateSemaphore/OpenSemaphore -> WaitForSingleObject/ReleaseSemaphore):
Code: [Select]
Code:
ff7_launcherCanReadMsgSem - Launcher waits on this semaphore, it's released by FF7 when the data is ready to be read by Launcher.ff7_launcherDidReadMsgSem - FF7 waits on this semaphore, it's released by Launcher when data to be read by Launcher has been read.ff7_gameCanReadMsgSem - FF7 waits on this semaphore, it's released by Launcher when data is ready to be read by FF7.ff7_gameDidReadMsgSem - Launcher waits on this semaphore, it's released by FF7 when data to be read by FF7 has been read.
IPC Protocol

For starters, the [] (square brackets) will be used for denoting the unicode string:
Code: [Select]
Code:
[Unicode string] - Basically a unicode string with first 4 bytes (little endian) being the length of the string in wide chars.If you need a complicated description, it's a structure built like this:X1 X2 X3 X4 C0 D0 C1 D1 C2 D2 ...X4X3X2X1 - string length in wide charsD0C0 - unicode character no0D1C1 - unicode character no1D1C1 - unicode character no2...No null terminator since the length is specified. Example of string "Hi!":03 00 00 00 48 00 69 00 21 00 | ....H.i.!.
Commands sent by the game:

CMD_G2L_01: Achievement unlocked
Code: [Select]
Code:
01 00 00 00 XX 00 00 00XX - Achievement Id
Notes: Sent by FF7 when new achievement has been unlocked.

CMD_G2L_02: Sync saved games
Code: [Select]
Code:
02 00 00 00
Notes: Sent when FF7 thinks it need the saved games to be synced. It greys out the save slot choose menu until either CMD_L2G_07 or CMD_L2G_08 is received.

CMD_G2L_03: Game saved/loaded
Code: [Select]
Code:
03 00 00 00 03 00 00 00 XX 00 00 00 YY 00 00 00 ZZ 00 00 00XX - 00 if saved, 01 if loadedYY - Save data file Id (00 - 09)ZZ - Saved game Id (00 - 0F)
Notes: Sent by FF7 when game has been saved or loaded.

CMD_G2L_04: Ready for init data
Code: [Select]
Code:
04 00 00 00
Notes: Sent by FF7 when it has inited the IPC module.

Commands sent by the launcher:

CMD_L2G_01: Set unlocked achievement
Code: [Select]
Code:
01 00 00 00 XX 00 00 00XX - Achievement Id
Notes: It is sent at startup for each achievement already unlocked.

CMD_L2G_07: Saved games synced successfully
Code: [Select]
Code:
07 00 00 00
CMD_L2G_08: Failed to sync saved games
Code: [Select]
Code:
08 00 00 00
CMD_L2G_09: Set save path
Code: [Select]
Code:
09 00 00 00 [Unicode string]
Notes: Sent at startup.

CMD_L2G_0A: Set config dir
Code: [Select]
Code:
0A 00 00 00 [Unicode string]
Notes: Sent at startup.

CMD_L2G_0B: Set game dir
Code: [Select]
Code:
0B 00 00 00 [Unicode string]
Notes: Sent at startup.

CMD_L2G_0C: Set lang dir
Code: [Select]
Code:
0C 00 00 00 [Unicode string]
Notes: Sent at startup.

CMD_L2G_0D: Set achievement data
Code: [Select]
Code:
0D 00 00 0000 00 00 00 [Achievement  0 name] [Achievement  0 description] [Achievement  0 icon]01 00 00 00 [Achievement  1 name] [Achievement  1 description] [Achievement  1 icon]02 00 00 00 [Achievement  2 name] [Achievement  2 description] [Achievement  2 icon]..                       ..                    ..                           ..23 00 00 00 [Achievement 35 name] [Achievement 35 description] [Achievement 35 icon]
Notes: Sent at startup - 36 entries total. Icons are in the data/xarch directory (*.fgt files being pngs). List of achievement Ids in the AppendixA.

CMD_L2G_0E: Set localization data
Code: [Select]
Code:
0E 00 00 0000 00 00 00 [Text   0]01 00 00 00 [Text   1]02 00 00 00 [Text   2]..                ...A2 00 00 00 [Text 162]
Notes: Sent at startup - 163 entries total. List of localization data in the AppendixB.

CMD_L2G_0F: Set keyboard data
Code: [Select]
Code:
0F 00 00 00 0E 00 00 00X0 00 00 00X1 00 00 00X2 00 00 00..XD 00 00 00
Notes: Sent at startup - 14 entries total being the keycodes. Note that this list only sends the data to be shown in the New game "Keyboard" screen, ff7input.cfg still holds the actual config. The order of the data is the same as in AppendixB list of Ids starting from 05, ending at 18.

CMD_L2G_10: Show message
Code: [Select]
Code:
10 00 00 00 [Message]
Notes: Mostly used for "Downloading save files".

CMD_L2G_11: Set version info
Code: [Select]
Code:
11 00 00 00 [Version string]
Notes: Sent at startup.

CMD_L2G_12: Pause game
Code: [Select]
Code:
12 00 00 00
Notes: Freezes the whole game (no "PAUSE")

CMD_L2G_13: Unpause game
Code: [Select]
Code:
13 00 00 00
Notes: Unfreezes the game.

CMD_L2G_14: Run the game
Code: [Select]
Code:
14 00 00 00
Notes: Sent when the launcher is done sending init data.

AppendixA: List of achievements with their Ids.
Code: [Select]
Code:
Achievement Id: 0Name: End of Part IDesc: Complete the first part of the gameFile: 48464.fgtAchievement Id: 1Name: End of Part IIDesc: Complete the second part of the gameFile: 86789746.fgtAchievement Id: 2Name: End of GameDesc: Complete FINAL FANTASY VIIFile: 788923.fgtAchievement Id: 3Name: Master MateriaDesc: Reach the maximum level of any MateriaFile: 048748899.fgtAchievement Id: 4Name: Master of GilDesc: 99,999,999 GilFile: 1248996.fgtAchievement Id: 5Name: Top LevelDesc: Reach level 99 with any characterFile: 3124788.fgtAchievement Id: 6Name: Knights of the RoundDesc: Get materia Knights of the RoundFile: 780075644896.fgtAchievement Id: 7Name: OmnislashDesc: Get Cloud's last Limit BreakFile: 6574897441.fgtAchievement Id: 8Name: CatastropheDesc: Get Barret's last Limit BreakFile: 7411663323.fgtAchievement Id: 9Name: ChaosDesc: Get Vincent's last Limit BreakFile: 34577888.fgtAchievement Id: 10Name: Great GospelDesc: Get Aeris's last Limit BreakFile: 9678414515.fgtAchievement Id: 11Name: HighwindDesc: Get Cid's last Limit BreakFile: 1548549646.fgtAchievement Id: 12Name: Final HeavenDesc: Get Tifa's last Limit BreakFile: 15896335.fgtAchievement Id: 13Name: All CreationDesc: Get Yuffie's last Limit BreakFile: 64848486.fgtAchievement Id: 14Name: Cosmo MemoryDesc: Get Red XIII's last Limit BreakFile: 247889666.fgtAchievement Id: 15Name: SlotsDesc: Get Cait Sith's last Limit BreakFile: 7478989663.fgtAchievement Id: 16Name: Bahamut ZeroDesc: Get materia Bahamut ZeroFile: 48748955454.fgtAchievement Id: 17Name: Ultimate WeaponDesc: Defeat the Ultimate WeaponFile: 97444543361.fgtAchievement Id: 18Name: Diamond WeaponDesc: Defeat the Diamond WeaponFile: 347895142.fgtAchievement Id: 19Name: Ruby WeaponDesc: Defeat the Ruby WeaponFile: 4154425789.fgtAchievement Id: 20Name: Emerald WeaponDesc: Defeat the Emerald WeaponFile: 3377854.fgtAchievement Id: 21Name: VincentDesc: Get Vincent on your teamFile: 1132477952.fgtAchievement Id: 22Name: YuffieDesc: Get Yuffie on your teamFile: 47851852.fgtAchievement Id: 23Name: Materia OverlordDesc: Master all MateriasFile: 852963745.fgtAchievement Id: 24Name: Battle SquareDesc: Start a battle in the Battle SquareFile: 1587462895.fgtAchievement Id: 25Name: Gold ChocoboDesc: Get a Gold ChocoboFile: 358749685.fgtAchievement Id: 26Name: Won 1st battleDesc: Win your first battleFile: 95856245.fgtAchievement Id: 27Name: BraverDesc: Use Cloud's 1st limitFile: 184575825.fgtAchievement Id: 28Name: Big ShotDesc: Use Barret's 1st limitFile: 6657748235.fgtAchievement Id: 29Name: Galian BeastDesc: Use Vincent's 1st limitFile: 075841114.fgtAchievement Id: 30Name: Healing WindDesc: Use Aeris's 1st limitFile: 57484155.fgtAchievement Id: 31Name: Boost JumpDesc: Use Cid's 1st limitFile: 36851458.fgtAchievement Id: 32Name: Beat RushDesc: Use Tifa's 1st limitFile: 6478254145.fgtAchievement Id: 33Name: Greased LightningDesc: Use Yuffie's 1st limitFile: 78564198.fgtAchievement Id: 34Name: Sled FangDesc: Use Red XIII's 1st limitFile: 25366999.fgtAchievement Id: 35Name: DiceDesc: Use Cait Sith's 1st limitFile: 748574726.fgt
AppendixB: List of localization texts with their Ids.
Code: [Select]
Code:
Entry Id: 0     Text: Achievement UnlockedEntry Id: 1     Text: Failed to sync save files, your progression will only be saved locallyEntry Id: 2     Text: Save files have been syncedEntry Id: 3     Text: KeyboardEntry Id: 4     Text: SELECT "QUIT" IN THE GAME MENU TO EXIT THE GAME.Entry Id: 5     Text: OKEntry Id: 6     Text: CancelEntry Id: 7     Text: MenuEntry Id: 8     Text: UpEntry Id: 9     Text: LeftEntry Id: 10    Text: RightEntry Id: 11    Text: DownEntry Id: 12    Text: StartEntry Id: 13    Text: SwitchEntry Id: 14    Text: Page upEntry Id: 15    Text: Page downEntry Id: 16    Text: TargetEntry Id: 17    Text: AssistEntry Id: 18    Text: CameraEntry Id: 19    Text: EscEntry Id: 20    Text: 1Entry Id: 21    Text: 2Entry Id: 22    Text: 3Entry Id: 23    Text: 4Entry Id: 24    Text: 5Entry Id: 25    Text: 6Entry Id: 26    Text: 7Entry Id: 27    Text: 8Entry Id: 28    Text: 9Entry Id: 29    Text: 0Entry Id: 30    Text: -Entry Id: 31    Text: =Entry Id: 32    Text: BackspaceEntry Id: 33    Text: TabEntry Id: 34    Text: QEntry Id: 35    Text: WEntry Id: 36    Text: EEntry Id: 37    Text: REntry Id: 38    Text: TEntry Id: 39    Text: YEntry Id: 40    Text: UEntry Id: 41    Text: IEntry Id: 42    Text: OEntry Id: 43    Text: PEntry Id: 44    Text: [Entry Id: 45    Text: ]Entry Id: 46    Text: EnterEntry Id: 47    Text: CtrlEntry Id: 48    Text: AEntry Id: 49    Text: SEntry Id: 50    Text: DEntry Id: 51    Text: FEntry Id: 52    Text: GEntry Id: 53    Text: HEntry Id: 54    Text: JEntry Id: 55    Text: KEntry Id: 56    Text: LEntry Id: 57    Text: ;Entry Id: 58    Text: 'Entry Id: 59    Text: `Entry Id: 60    Text: ShiftEntry Id: 61    Text: \Entry Id: 62    Text: ZEntry Id: 63    Text: XEntry Id: 64    Text: CEntry Id: 65    Text: VEntry Id: 66    Text: BEntry Id: 67    Text: NEntry Id: 68    Text: MEntry Id: 69    Text: ,Entry Id: 70    Text: .Entry Id: 71    Text: /Entry Id: 72    Text: Right ShiftEntry Id: 73    Text: *Entry Id: 74    Text: AltEntry Id: 75    Text: SpaceEntry Id: 76    Text: Caps LockEntry Id: 77    Text: F1Entry Id: 78    Text: F2Entry Id: 79    Text: F3Entry Id: 80    Text: F4Entry Id: 81    Text: F5Entry Id: 82    Text: F6Entry Id: 83    Text: F7Entry Id: 84    Text: F8Entry Id: 85    Text: F9Entry Id: 86    Text: F10Entry Id: 87    Text: Num LockEntry Id: 88    Text: Scroll LockEntry Id: 89    Text: Num 7Entry Id: 90    Text: Num 8Entry Id: 91    Text: Num 9Entry Id: 92    Text: -Entry Id: 93    Text: Num 4Entry Id: 94    Text: Num 5Entry Id: 95    Text: Num 6Entry Id: 96    Text: +Entry Id: 97    Text: Num 1Entry Id: 98    Text: Num 2Entry Id: 99    Text: Num 3Entry Id: 100   Text: Num 0Entry Id: 101   Text: Num DelEntry Id: 102   Text: \Entry Id: 103   Text: F11Entry Id: 104   Text: F12Entry Id: 105   Text:Entry Id: 106   Text:Entry Id: 107   Text:Entry Id: 108   Text:Entry Id: 109   Text:Entry Id: 110   Text:Entry Id: 111   Text:Entry Id: 112   Text:Entry Id: 113   Text: F15Entry Id: 114   Text:Entry Id: 115   Text:Entry Id: 116   Text:Entry Id: 117   Text:Entry Id: 118   Text:Entry Id: 119   Text:Entry Id: 120   Text:Entry Id: 121   Text:Entry Id: 122   Text:Entry Id: 123   Text:Entry Id: 124   Text: Num EnterEntry Id: 125   Text: Right CtrlEntry Id: 126   Text:Entry Id: 127   Text:Entry Id: 128   Text:Entry Id: 129   Text:Entry Id: 130   Text:Entry Id: 131   Text:Entry Id: 132   Text:Entry Id: 133   Text:Entry Id: 134   Text: Num /Entry Id: 135   Text: Prnt ScrnEntry Id: 136   Text: Right AltEntry Id: 137   Text: PauseEntry Id: 138   Text: HomeEntry Id: 139   Text: UpEntry Id: 140   Text: Page UpEntry Id: 141   Text: LeftEntry Id: 142   Text: RightEntry Id: 143   Text: EndEntry Id: 144   Text: DownEntry Id: 145   Text: Page DownEntry Id: 146   Text: InsertEntry Id: 147   Text: DeleteEntry Id: 148   Text: Left WindowsEntry Id: 149   Text: Right WindowsEntry Id: 150   Text: ApplicationEntry Id: 151   Text:Entry Id: 152   Text:Entry Id: 153   Text:Entry Id: 154   Text:Entry Id: 155   Text:Entry Id: 156   Text:Entry Id: 157   Text:Entry Id: 158   Text: ForwardEntry Id: 159   Text:Entry Id: 160   Text:Entry Id: 161   Text:Entry Id: 162   Text:
 
Last edited:
Excellent work, as always!
Thx :p If anyone has any additional info on the inner workings on the IPC, don't hesitate to post. There might also be a bug here, somewhere ;p
 
Hey dziugo, i don't think that this is related but it has to do with the launcher. There is a file (lang.ini) with text strings for the launcher that includes almost all languages but for some reason even if i replace the whole english entry the text in the launcher is still in english almost if the text is hardcoded and not read from the text... do you think you can check that out to see what's going on? Even if you change the lang.dat to a code of a language that is not included in the game but is included in the launcher it won't change
 
Hi Ombra. Haven't looked at it yet (and can't look at it right now), but IIRC lang.ini holds strings for SecuROM activation module, not the actual Launcher. Might be wrong, don't bet on it ;p

I know that strings.dat holds localized strings, but dunno if it's just for the game, or also for the launcher (that's on a TODO list).
 
Might we be able to use this info to make our own achievements?
 
Hi Ombra. Haven't looked at it yet (and can't look at it right now), but IIRC lang.ini holds strings for SecuROM activation module, not the actual Launcher. Might be wrong, don't bet on it ;p

I know that strings.dat holds localized strings, but dunno if it's just for the game, or also for the launcher (that's on a TODO list).
Ok, so now i can confirm that strings.dat holds texts for both Launcher and FF7.

Might we be able to use this info to make our own achievements?
No, sorry, that would be not enough. First of all, the new-engine needs to be changed to include new achievements, and then the launcher to feed data for the new achievements. Not trivial task.
 
Hey dziugo,

first of all sorry for posting here after so long but it is related to the same topic so opening a new post seemed redundant. I haven't been able to look at it further but i finally did so here it is:

FF7Launcher.exe contains the text in english which is supposed to use as a reference for translation. Once the EXE loads there is a routine that checks lang.dat for the language code and then it is supposed to load the text itself from strings.dat. Now here is an interesting fact. If the locale is set to ENG no matter what the text is loaded from the FF7Launcher itself instead of loading the strings for EN locale already inside strings.dat. As soon as you switch the locale to something else (fr, de, es) it loads the text from strings.dat the way it is supposed to be.

Now my objective is to add a check to the main routine for another language and include all the translated text to strings.dat but i can't figure out the format of it. The way the exe is structured looks like a "case" option (if en then, else if fr then...) so adding a check for another locale shouldn't be hard. Real problem is how to modify the strings.dat. Do you think you can look at it?

for example es locale in strings.dat starts at offset 0x01ACBC til EOF, problem is i can't figure out how the file reads each part and how it points to each string
 
By looking a little harder at it...

-------------------------------------
HEADER:
-------------------------------------

0400 0000        // Numer of sections?
E803 0000 - 000003E8 // Incremental?
A089 0000 - 000089A0 // Size of Section EN
E903 0000 - 000003E9 // Incremental?
5691 0000 - 00009156 // Size of Section FR
EA03 0000 - 000003EA // Incremental?
A491 0000 - 000091A4 // Size of Section DE
EB03 0000 - 000003EB // Incremental?
3691 0000 - 00009136 // Size of Section ES
About each section i figured out how the text is organized and it starts at offset 0x5FE in the file (for the english part):

-------------------------------------
SECTION 1:
-------------------------------------
0x01 = Beginning of String/Type of String // Always 03?
0x04 = Size of String
0xXX = String // Translated string
0x02 = End of String/Type of String? // Always 08 00?
0x04 = Unknown // Always 00 00 00 06?
0x04 = Size of String
0xXX = String // Reference string
0x01 = End of String/Type of String? // Always 07?
0x04 = Size of String
0xXX = String //Screen where the text goes
0x01 = End of String/Type of String? // Always 01?
...
-------------------------------------

88 // Unknown
00 00 00 02 // Unknown
Now the pointers... can't figure them out

3C B864 18CA EF9C 95CD 211C BF60 A1BD DD42 // Unknown 17 bytes but always the same

00000F20 //Pointer to first line of text
0000055B //Unknown

0000174A //Unknown
0000055B //Unknown

00001775 //Unknown
0000055B //Unknown

...
 
Last edited:
Status
Not open for further replies.
Back
Top