Author Topic: [PC FF7 2012] FF7 ReRelease IPC (Inter-Process Communication)  (Read 7479 times)


  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
IPC Description

Shared memory is used for sending data between Launcher and FF7 (CreateFileMapping -> MapViewOfFile):
Code: [Select]
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]
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]
[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 chars
D0C0 - unicode character no0
D1C1 - unicode character no1
D1C1 - 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]
01 00 00 00 XX 00 00 00
XX - Achievement Id
Notes: Sent by FF7 when new achievement has been unlocked.

CMD_G2L_02: Sync saved games
Code: [Select]
02 00 00 00Notes: 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]
03 00 00 00 03 00 00 00 XX 00 00 00 YY 00 00 00 ZZ 00 00 00
XX - 00 if saved, 01 if loaded
YY - 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]
04 00 00 00Notes: Sent by FF7 when it has inited the IPC module.

Commands sent by the launcher:

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

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

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

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

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

CMD_L2G_0D: Set achievement data
Code: [Select]
0D 00 00 00
00 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]
0E 00 00 00
00 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]
0F 00 00 00 0E 00 00 00
X0 00 00 00
X1 00 00 00
X2 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]
10 00 00 00 [Message]Notes: Mostly used for "Downloading save files".

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

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

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

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

AppendixA: List of achievements with their Ids.
Code: [Select]
Achievement Id: 0
Name: End of Part I
Desc: Complete the first part of the game
File: 48464.fgt
Achievement Id: 1
Name: End of Part II
Desc: Complete the second part of the game
File: 86789746.fgt
Achievement Id: 2
Name: End of Game
File: 788923.fgt
Achievement Id: 3
Name: Master Materia
Desc: Reach the maximum level of any Materia
File: 048748899.fgt
Achievement Id: 4
Name: Master of Gil
Desc: 99,999,999 Gil
File: 1248996.fgt
Achievement Id: 5
Name: Top Level
Desc: Reach level 99 with any character
File: 3124788.fgt
Achievement Id: 6
Name: Knights of the Round
Desc: Get materia Knights of the Round
File: 780075644896.fgt
Achievement Id: 7
Name: Omnislash
Desc: Get Cloud's last Limit Break
File: 6574897441.fgt
Achievement Id: 8
Name: Catastrophe
Desc: Get Barret's last Limit Break
File: 7411663323.fgt
Achievement Id: 9
Name: Chaos
Desc: Get Vincent's last Limit Break
File: 34577888.fgt
Achievement Id: 10
Name: Great Gospel
Desc: Get Aeris's last Limit Break
File: 9678414515.fgt
Achievement Id: 11
Name: Highwind
Desc: Get Cid's last Limit Break
File: 1548549646.fgt
Achievement Id: 12
Name: Final Heaven
Desc: Get Tifa's last Limit Break
File: 15896335.fgt
Achievement Id: 13
Name: All Creation
Desc: Get Yuffie's last Limit Break
File: 64848486.fgt
Achievement Id: 14
Name: Cosmo Memory
Desc: Get Red XIII's last Limit Break
File: 247889666.fgt
Achievement Id: 15
Name: Slots
Desc: Get Cait Sith's last Limit Break
File: 7478989663.fgt
Achievement Id: 16
Name: Bahamut Zero
Desc: Get materia Bahamut Zero
File: 48748955454.fgt
Achievement Id: 17
Name: Ultimate Weapon
Desc: Defeat the Ultimate Weapon
File: 97444543361.fgt
Achievement Id: 18
Name: Diamond Weapon
Desc: Defeat the Diamond Weapon
File: 347895142.fgt
Achievement Id: 19
Name: Ruby Weapon
Desc: Defeat the Ruby Weapon
File: 4154425789.fgt
Achievement Id: 20
Name: Emerald Weapon
Desc: Defeat the Emerald Weapon
File: 3377854.fgt
Achievement Id: 21
Name: Vincent
Desc: Get Vincent on your team
File: 1132477952.fgt
Achievement Id: 22
Name: Yuffie
Desc: Get Yuffie on your team
File: 47851852.fgt
Achievement Id: 23
Name: Materia Overlord
Desc: Master all Materias
File: 852963745.fgt
Achievement Id: 24
Name: Battle Square
Desc: Start a battle in the Battle Square
File: 1587462895.fgt
Achievement Id: 25
Name: Gold Chocobo
Desc: Get a Gold Chocobo
File: 358749685.fgt
Achievement Id: 26
Name: Won 1st battle
Desc: Win your first battle
File: 95856245.fgt
Achievement Id: 27
Name: Braver
Desc: Use Cloud's 1st limit
File: 184575825.fgt
Achievement Id: 28
Name: Big Shot
Desc: Use Barret's 1st limit
File: 6657748235.fgt
Achievement Id: 29
Name: Galian Beast
Desc: Use Vincent's 1st limit
File: 075841114.fgt
Achievement Id: 30
Name: Healing Wind
Desc: Use Aeris's 1st limit
File: 57484155.fgt
Achievement Id: 31
Name: Boost Jump
Desc: Use Cid's 1st limit
File: 36851458.fgt
Achievement Id: 32
Name: Beat Rush
Desc: Use Tifa's 1st limit
File: 6478254145.fgt
Achievement Id: 33
Name: Greased Lightning
Desc: Use Yuffie's 1st limit
File: 78564198.fgt
Achievement Id: 34
Name: Sled Fang
Desc: Use Red XIII's 1st limit
File: 25366999.fgt
Achievement Id: 35
Name: Dice
Desc: Use Cait Sith's 1st limit
File: 748574726.fgt

AppendixB: List of localization texts with their Ids.
Code: [Select]
Entry Id: 0     Text: Achievement Unlocked
Entry Id: 1     Text: Failed to sync save files, your progression will only be saved locally
Entry Id: 2     Text: Save files have been synced
Entry Id: 3     Text: Keyboard
Entry Id: 5     Text: OK
Entry Id: 6     Text: Cancel
Entry Id: 7     Text: Menu
Entry Id: 8     Text: Up
Entry Id: 9     Text: Left
Entry Id: 10    Text: Right
Entry Id: 11    Text: Down
Entry Id: 12    Text: Start
Entry Id: 13    Text: Switch
Entry Id: 14    Text: Page up
Entry Id: 15    Text: Page down
Entry Id: 16    Text: Target
Entry Id: 17    Text: Assist
Entry Id: 18    Text: Camera
Entry Id: 19    Text: Esc
Entry Id: 20    Text: 1
Entry Id: 21    Text: 2
Entry Id: 22    Text: 3
Entry Id: 23    Text: 4
Entry Id: 24    Text: 5
Entry Id: 25    Text: 6
Entry Id: 26    Text: 7
Entry Id: 27    Text: 8
Entry Id: 28    Text: 9
Entry Id: 29    Text: 0
Entry Id: 30    Text: -
Entry Id: 31    Text: =
Entry Id: 32    Text: Backspace
Entry Id: 33    Text: Tab
Entry Id: 34    Text: Q
Entry Id: 35    Text: W
Entry Id: 36    Text: E
Entry Id: 37    Text: R
Entry Id: 38    Text: T
Entry Id: 39    Text: Y
Entry Id: 40    Text: U
Entry Id: 41    Text: I
Entry Id: 42    Text: O
Entry Id: 43    Text: P
Entry Id: 44    Text: [
Entry Id: 45    Text: ]
Entry Id: 46    Text: Enter
Entry Id: 47    Text: Ctrl
Entry Id: 48    Text: A
Entry Id: 49    Text: S
Entry Id: 50    Text: D
Entry Id: 51    Text: F
Entry Id: 52    Text: G
Entry Id: 53    Text: H
Entry Id: 54    Text: J
Entry Id: 55    Text: K
Entry Id: 56    Text: L
Entry Id: 57    Text: ;
Entry Id: 58    Text: '
Entry Id: 59    Text: `
Entry Id: 60    Text: Shift
Entry Id: 61    Text: \
Entry Id: 62    Text: Z
Entry Id: 63    Text: X
Entry Id: 64    Text: C
Entry Id: 65    Text: V
Entry Id: 66    Text: B
Entry Id: 67    Text: N
Entry Id: 68    Text: M
Entry Id: 69    Text: ,
Entry Id: 70    Text: .
Entry Id: 71    Text: /
Entry Id: 72    Text: Right Shift
Entry Id: 73    Text: *
Entry Id: 74    Text: Alt
Entry Id: 75    Text: Space
Entry Id: 76    Text: Caps Lock
Entry Id: 77    Text: F1
Entry Id: 78    Text: F2
Entry Id: 79    Text: F3
Entry Id: 80    Text: F4
Entry Id: 81    Text: F5
Entry Id: 82    Text: F6
Entry Id: 83    Text: F7
Entry Id: 84    Text: F8
Entry Id: 85    Text: F9
Entry Id: 86    Text: F10
Entry Id: 87    Text: Num Lock
Entry Id: 88    Text: Scroll Lock
Entry Id: 89    Text: Num 7
Entry Id: 90    Text: Num 8
Entry Id: 91    Text: Num 9
Entry Id: 92    Text: -
Entry Id: 93    Text: Num 4
Entry Id: 94    Text: Num 5
Entry Id: 95    Text: Num 6
Entry Id: 96    Text: +
Entry Id: 97    Text: Num 1
Entry Id: 98    Text: Num 2
Entry Id: 99    Text: Num 3
Entry Id: 100   Text: Num 0
Entry Id: 101   Text: Num Del
Entry Id: 102   Text: \
Entry Id: 103   Text: F11
Entry Id: 104   Text: F12
Entry 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: F15
Entry 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 Enter
Entry Id: 125   Text: Right Ctrl
Entry 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 Scrn
Entry Id: 136   Text: Right Alt
Entry Id: 137   Text: Pause
Entry Id: 138   Text: Home
Entry Id: 139   Text: Up
Entry Id: 140   Text: Page Up
Entry Id: 141   Text: Left
Entry Id: 142   Text: Right
Entry Id: 143   Text: End
Entry Id: 144   Text: Down
Entry Id: 145   Text: Page Down
Entry Id: 146   Text: Insert
Entry Id: 147   Text: Delete
Entry Id: 148   Text: Left Windows
Entry Id: 149   Text: Right Windows
Entry Id: 150   Text: Application
Entry 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: Forward
Entry Id: 159   Text:
Entry Id: 160   Text:
Entry Id: 161   Text:
Entry Id: 162   Text:
« Last Edit: 2012-09-10 21:19:47 by dziugo »


  • Banned
  • *
  • Posts: 11025
    • View Profile
Excellent work, as always!


  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
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


  • *
  • Posts: 110
    • View Profile
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


  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
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).


  • *
  • Posts: 65
    • View Profile
    • Five Rings
Might we be able to use this info to make our own achievements?


  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
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.


  • *
  • Posts: 110
    • View Profile
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


  • *
  • Posts: 110
    • View Profile
By looking a little harder at it...


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):

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 Edit: 2013-01-15 19:40:10 by _Ombra_ »