diff --git a/build.bat b/build.bat index 30da113..755ce15 100644 --- a/build.bat +++ b/build.bat @@ -1,2 +1,3 @@ @echo off -cl.exe main.c /Fe: vstrack /DDEBUG /nologo /Zi /link user32.lib psapi.lib Wtsapi32.lib Advapi32.lib \ No newline at end of file +cls +cl.exe main.c /Fe: vstrack /DDEBUG /nologo /Zi /link user32.lib psapi.lib Wtsapi32.lib Advapi32.lib diff --git a/includes/vst_actors.h b/includes/vst_actors.h index 9059e77..e012d0a 100644 --- a/includes/vst_actors.h +++ b/includes/vst_actors.h @@ -6,339 +6,310 @@ #define MAX_ACTORS_NUMBER 15 #define ACTORS_NAMES_LIST_LENGTH 108 -char *ActorsNamesList[ACTORS_NAMES_LIST_LENGTH] = { // - "Air Elemental", // - "Arch Dragon", // - "Ashley Riot", // - "Asura", // - "Bandit", // - "Basilisk", // - "Bat", // - "Bejart", // - "Blood Lizard", // - "Callo Merlose", // - "City Gaurd", // - "Crimson Blade", // - "Damascus Crab", // - "Damascus Golem", // - "Dao", // - "Dark Crusader", // - "Dark Dragon", // - "Dark Elemental", // - "Dark Skeleton", // - "Dark Eye", // - "Dead Crimson Blade", // - "Death", // - "Djinn", // - "Dragon", // - "Dragon Zombie", // - "Duane", // - "Duke Bardorba", // - "Dullahan", // - "Dummy", // - "Earth Dragon", // - "Earth Elemental", // - "Fire Elemental", // - "Flame Dragon", // - "Gargoyle", // - "Ghast", // - "Ghost", // - "Ghoul", // - "Giant Crab", // - "Goblin", // - "Goblin Leader", // - "Golem", // - "Goodwin", // - "Gremlin", // - "Grissom", // - "Guildenstern", // - "Harpy", // - "Hellhound", // - "Ichthious", // - "Ifrit", // - "Imp", // - "Iron Crab", // - "Iron Golem", // - "John Hardin", // - "Joshua Bardorba", // - "Kali", // - "Last Crusader", // - "Lich", // - "Lich Lord", // - "Lizardman", // - "Lord Joshua", // - "Mandel", // - "Marco Riot", // - "Marid", // - "Matrix Ashley", // - "Matrix Merlose", // - "Mimic", // - "Minotaur", // - "Minotaur Lord", // - "Minotaur Zombie", // - "Mullenkamp Soldier", // change 'ü' to 'u'? - "Mummy", // - "Neesa", // - "Nightmare", // - "Nightstalker", // - "Ogre", // - "Ogre Lord", // - "Ogre Zombie", // - "Orc", // - "Orc Leader", // - "Poison Slime", // - "Quicksilver", // - "Ravana", // - "Rosencrantz", // - "Sackheim", // - "Samantha", // - "Sarjik", // - "Shadow", // - "Shrieker", // - "Silver Wolf", // - "Skeleton", // - "Skeleton Knight", // - "Sky Dragon", // - "Slime", // - "Snow Dragon", // - "Stirge", // - "Sydney Losstarot", // probably not used in this form (look below) - "Sydney", // - "Tia Riot", // - "Tieger", // - "Water Elemental", // - "Wraith", // - "Wyvern", // - "Wyvern Knight", // - "Wyvern Queen", // - "Zombie", // - "Zombie Fighter", // - "Zombie Knight", // - "Zombie Mage" +wchar_t *ActorsNamesList[ACTORS_NAMES_LIST_LENGTH] = { // + L"Air Elemental", // + L"Arch Dragon", // + L"Ashley Riot", // + L"Asura", // + L"Bandit", // + L"Basilisk", // + L"Bat", // + L"Bejart", // + L"Blood Lizard", // + L"Callo Merlose", // + L"City Gaurd", // + L"Crimson Blade", // + L"Damascus Crab", // + L"Damascus Golem", // + L"Dao", // + L"Dark Crusader", // + L"Dark Dragon", // + L"Dark Elemental", // + L"Dark Skeleton", // + L"Dark Eye", // + L"Dead Crimson Blade", // + L"Death", // + L"Djinn", // + L"Dragon", // + L"Dragon Zombie", // + L"Duane", // + L"Duke Bardorba", // + L"Dullahan", // + L"Dummy", // + L"Earth Dragon", // + L"Earth Elemental", // + L"Fire Elemental", // + L"Flame Dragon", // + L"Gargoyle", // + L"Ghast", // + L"Ghost", // + L"Ghoul", // + L"Giant Crab", // + L"Goblin", // + L"Goblin Leader", // + L"Golem", // + L"Goodwin", // + L"Gremlin", // + L"Grissom", // + L"Guildenstern", // + L"Harpy", // + L"Hellhound", // + L"Ichthious", // + L"Ifrit", // + L"Imp", // + L"Iron Crab", // + L"Iron Golem", // + L"John Hardin", // + L"Joshua Bardorba", // + L"Kali", // + L"Last Crusader", // + L"Lich", // + L"Lich Lord", // + L"Lizardman", // + L"Lord Joshua", // + L"Mandel", // + L"Marco Riot", // + L"Marid", // + L"Matrix Ashley", // + L"Matrix Merlose", // + L"Mimic", // + L"Minotaur", // + L"Minotaur Lord", // + L"Minotaur Zombie", // + L"Müllenkamp Soldier", // change 'ü' to 'u'? + //L"Mullenkamp Soldier", // change 'ü' to 'u'? + L"Mummy", // + L"Neesa", // + L"Nightmare", // + L"Nightstalker", // + L"Ogre", // + L"Ogre Lord", // + L"Ogre Zombie", // + L"Orc", // + L"Orc Leader", // + L"Poison Slime", // + L"Quicksilver", // + L"Ravana", // + L"Rosencrantz", // + L"Sackheim", // + L"Samantha", // + L"Sarjik", // + L"Shadow", // + L"Shrieker", // + L"Silver Wolf", // + L"Skeleton", // + L"Skeleton Knight", // + L"Sky Dragon", // + L"Slime", // + L"Snow Dragon", // + L"Stirge", // + L"Sydney Losstarot", // probably not used in this form (look below) + L"Sydney", // + L"Tia Riot", // + L"Tieger", // + L"Water Elemental", // + L"Wraith", // + L"Wyvern", // + L"Wyvern Knight", // + L"Wyvern Queen", // + L"Zombie", // + L"Zombie Fighter", // + L"Zombie Knight", // + L"Zombie Mage" }; void -ReadActorPointer(u32 *ActorPointer, usize ActorNumber) -{ - usize BytesToRead = sizeof(u32); +ReadActorPointer(u32 *ActorPointer, usize ActorNumber) { + usize BytesToRead = sizeof(u32); - ReadGameMemory(processID, - OFFSET_ACTOR_DATA_POINTERS + (ActorNumber * sizeof(u32)), BytesToRead, - ActorPointer); + ReadGameMemory(processID, + OFFSET_ACTOR_DATA_POINTERS + (ActorNumber * sizeof(u32)), BytesToRead, + ActorPointer); } void -ReadActorData(actor_data *ActorData, u32 ActorPointer) -{ - usize BytesToRead = sizeof(actor_data); +ReadActorData(actor_data *ActorData, u32 ActorPointer) { + usize BytesToRead = sizeof(actor_data); - ReadGameMemory(processID, (usize) ActorPointer, BytesToRead, ActorData); + ReadGameMemory(processID, (usize) ActorPointer, BytesToRead, ActorData); } void -ReadNextActorPointer(u32 *ActorPointerCur, u32 *ActorPointerNext) -{ - actor_data ActorDataTemp; - ReadActorData(&ActorDataTemp, *ActorPointerCur); - *ActorPointerNext = ActorDataTemp.NextActorPtr; +ReadNextActorPointer(u32 *ActorPointerCur, u32 *ActorPointerNext) { + actor_data ActorDataTemp; + ReadActorData(&ActorDataTemp, *ActorPointerCur); + *ActorPointerNext = ActorDataTemp.NextActorPtr; } BOOL -IsActorNameValid(char *ActorName) -{ - for (int i = 0; i < ACTORS_NAMES_LIST_LENGTH; i++) - { - - if (strcmp(ActorName, ActorsNamesList[i]) == 0) - { - return TRUE; +IsActorNameValid(wchar_t *ActorName) { + for (int i = 0; i < ACTORS_NAMES_LIST_LENGTH; i++) { + if (wcscmp(ActorName, ActorsNamesList[i]) == 0) { + return TRUE; + } } - } - return FALSE; + return FALSE; } void -PrintActorsDataOld() -{ - sprintf(szBuffer, "\nACTIVE ACTORS:\n"); - WriteToBackBuffer(); - - actor_data ActorData; - u32 ActorPointer = 0; - u32 ActiveActorMarker = 0; - - // ReadActiveActorMarker(OFFSET_ACTIVE_ACTOR_MARKER, &ActiveActorMarker); - // sprintf(szBuffer, "ActiveActorMarker: 0x%x\n", ActiveActorMarker); - // WriteToBackBuffer(); - - for (int i = 2; i < MAX_ACTORS_NUMBER; i++) - { - ReadActorPointer(&ActorPointer, i); - if (ActorPointer) - { - ReadActorData(&ActorData, ActorPointer); - - // u32 NameOffset = ActorPointer + (u32) offsetof(actor_data, Name); - ReadActorName(ActorData.NamePointer); - - if (IsActorNameValid(ActorName)) - { +PrintActorsDataOld() { + swprintf_s(szBuffer, _countof(szBuffer), L"\nACTIVE ACTORS:\n"); + WriteToBackBuffer(); + + actor_data ActorData; + u32 ActorPointer = 0; + u32 ActiveActorMarker = 0; + + // ReadActiveActorMarker(OFFSET_ACTIVE_ACTOR_MARKER, &ActiveActorMarker); + // swprintf_s(szBuffer, _countof(szBuffer), L"ActiveActorMarker: 0x%x\n", ActiveActorMarker); + // WriteToBackBuffer(); + + for (int i = 2; i < MAX_ACTORS_NUMBER; i++) { + ReadActorPointer(&ActorPointer, i); + if (ActorPointer) { + ReadActorData(&ActorData, ActorPointer); + + // u32 NameOffset = ActorPointer + (u32) offsetof(actor_data, Name); + ReadActorName(ActorData.NamePointer); + + if (IsActorNameValid(ActorName)) { + u16 HPCur = ActorData.HPCur; + u16 HPMax = ActorData.HPMax; + u16 MPCur = ActorData.MPCur; + u16 MPMax = ActorData.MPMax; + + if (GameStatus == GAME_STATUS_CUTSCENE && HPMax == 100 && + MPMax == 100) { // cutscene + return; + } + + if (HPCur == 0) continue; + + swprintf_s(szBuffer, _countof(szBuffer), L"%s -- ", ActorName); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), L"HP %d/%d ", HPCur, HPMax); + WriteToBackBuffer(); + + if (MPMax > 0) { + swprintf_s(szBuffer, _countof(szBuffer), L"MP %d/%d ", MPCur, MPMax); + } + + swprintf_s(szBuffer, _countof(szBuffer), L"ADDR 0x%x ", ActorPointer); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), L"\n"); + WriteToBackBuffer(); + } + } + } +} + +void +PrintActorsData() { + swprintf_s(szBuffer, _countof(szBuffer), L"\nACTIVE ACTORS:\n"); + WriteToBackBuffer(); + + actor_data ActorData; + u32 ActorPointerCur = OFFSET_ACTOR_DATA_POINTERS; + u32 ActorPointerNext = 0x000000; + + // swprintf_s(szBuffer, _countof(szBuffer), L"ADDR 0x%x\n", ActorPointerCur); + // WriteToBackBuffer(); + + ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); + while (ActorPointerNext) { + ReadActorData(&ActorData, ActorPointerNext); + + ReadActorName(ActorData.NamePointer); + u16 HPCur = ActorData.HPCur; u16 HPMax = ActorData.HPMax; u16 MPCur = ActorData.MPCur; u16 MPMax = ActorData.MPMax; if (GameStatus == GAME_STATUS_CUTSCENE && HPMax == 100 && - MPMax == 100) // cutscene - { - return; + MPMax == 100) { // cutscene + return; } - if (HPCur == 0) - { - continue; - } - - sprintf(szBuffer, "%s -- ", ActorName); + swprintf_s(szBuffer, _countof(szBuffer), L"0x%x -- ", ActorPointerNext); WriteToBackBuffer(); - sprintf(szBuffer, "HP %d/%d ", HPCur, HPMax); + swprintf_s(szBuffer, _countof(szBuffer), L"%s -- ", ActorName); WriteToBackBuffer(); - if (MPMax > 0) - { - sprintf(szBuffer, "MP %d/%d ", MPCur, MPMax); + if (HPCur == 0) { + swprintf_s(szBuffer, _countof(szBuffer), L"Dead "); + WriteToBackBuffer(); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"HP %d/%d ", HPCur, HPMax); + WriteToBackBuffer(); + + if (MPMax > 0) { + swprintf_s(szBuffer, _countof(szBuffer), L"MP %d/%d ", MPCur, MPMax); + WriteToBackBuffer(); + } } - - sprintf(szBuffer, "ADDR 0x%x ", ActorPointer); + swprintf_s(szBuffer, _countof(szBuffer), L"\n"); WriteToBackBuffer(); - sprintf(szBuffer, "\n"); - WriteToBackBuffer(); - } + ActorPointerCur = ActorPointerNext; + ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); } - } } void -PrintActorsData() -{ - sprintf(szBuffer, "\nACTIVE ACTORS:\n"); - WriteToBackBuffer(); - - actor_data ActorData; - u32 ActorPointerCur = OFFSET_ACTOR_DATA_POINTERS; - u32 ActorPointerNext = 0x000000; - - // sprintf(szBuffer, "ADDR 0x%x\n", ActorPointerCur); - // WriteToBackBuffer(); - - ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); - while (ActorPointerNext) - { - ReadActorData(&ActorData, ActorPointerNext); - - ReadActorName(ActorData.NamePointer); - - u16 HPCur = ActorData.HPCur; - u16 HPMax = ActorData.HPMax; - u16 MPCur = ActorData.MPCur; - u16 MPMax = ActorData.MPMax; - - if (GameStatus == GAME_STATUS_CUTSCENE && HPMax == 100 && - MPMax == 100) // cutscene - { - return; - } +WriteActorsData() { + FILE *fpActorsData = _wfopen(L"game_data/map/enemy_data.txt", L"w"); - sprintf(szBuffer, "0x%x -- ", ActorPointerNext); - WriteToBackBuffer(); + fwprintf(fpActorsData, L"Active Enemies\n"); - sprintf(szBuffer, "%s -- ", ActorName); - WriteToBackBuffer(); + actor_data ActorData; + // Use this one if you want to include player data: + // u32 ActorPointerCur = OFFSET_ACTOR_DATA_POINTERS; + u32 ActorPointerCur = OFFSET_ACTOR_DATA_FIRST_NODE; + u32 ActorPointerNext = 0x000000; - if (HPCur == 0) - { - sprintf(szBuffer, "Dead "); - WriteToBackBuffer(); - } - else - { - sprintf(szBuffer, "HP %d/%d ", HPCur, HPMax); - WriteToBackBuffer(); - - if (MPMax > 0) - { - sprintf(szBuffer, "MP %d/%d ", MPCur, MPMax); - WriteToBackBuffer(); - } - } - sprintf(szBuffer, "\n"); - WriteToBackBuffer(); + // swprintf_s(fpActorsData, _countof(szBuffer), L"ADDR 0x%x\n", ActorPointerCur); + // WriteToBackBuffer(); - ActorPointerCur = ActorPointerNext; ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); - } -} - -void -WriteActorsData() -{ - FILE *fpActorsData = fopen("game_data/map/enemy_data.txt", "w"); + while (ActorPointerNext) { + ReadActorData(&ActorData, ActorPointerNext); - fprintf(fpActorsData, "Active Enemies\n"); + ReadActorName(ActorData.NamePointer); - actor_data ActorData; - // Use this one if you want to include player data: - // u32 ActorPointerCur = OFFSET_ACTOR_DATA_POINTERS; - u32 ActorPointerCur = OFFSET_ACTOR_DATA_FIRST_NODE; - u32 ActorPointerNext = 0x000000; - - // sprintf(fpActorsData, "ADDR 0x%x\n", ActorPointerCur); - // WriteToBackBuffer(); - - ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); - while (ActorPointerNext) - { - ReadActorData(&ActorData, ActorPointerNext); + u16 HPCur = ActorData.HPCur; + u16 HPMax = ActorData.HPMax; + u16 MPCur = ActorData.MPCur; + u16 MPMax = ActorData.MPMax; - ReadActorName(ActorData.NamePointer); + if (GameStatus == GAME_STATUS_CUTSCENE && HPMax == 100 && + MPMax == 100) { // cutscene + return; + } - u16 HPCur = ActorData.HPCur; - u16 HPMax = ActorData.HPMax; - u16 MPCur = ActorData.MPCur; - u16 MPMax = ActorData.MPMax; + // fwprintf(fpActorsData, L"0x%x -- ", ActorPointerNext); - if (GameStatus == GAME_STATUS_CUTSCENE && HPMax == 100 && - MPMax == 100) // cutscene - { - return; - } + fwprintf(fpActorsData, L"%s -- ", ActorName); - // fprintf(fpActorsData, "0x%x -- ", ActorPointerNext); + if (HPCur == 0) { + fwprintf(fpActorsData, L"Dead "); + } else { + fwprintf(fpActorsData, L"HP %d/%d ", HPCur, HPMax); - fprintf(fpActorsData, "%s -- ", ActorName); + if (MPMax > 0) { + fwprintf(fpActorsData, L"MP %d/%d ", MPCur, MPMax); + } + } + fwprintf(fpActorsData, L"\n"); - if (HPCur == 0) - { - fprintf(fpActorsData, "Dead "); + ActorPointerCur = ActorPointerNext; + ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); } - else - { - fprintf(fpActorsData, "HP %d/%d ", HPCur, HPMax); - - if (MPMax > 0) - { - fprintf(fpActorsData, "MP %d/%d ", MPCur, MPMax); - } - } - fprintf(fpActorsData, "\n"); - - ActorPointerCur = ActorPointerNext; - ReadNextActorPointer(&ActorPointerCur, &ActorPointerNext); - } - fclose(fpActorsData); + fclose(fpActorsData); } #endif diff --git a/includes/vst_console.h b/includes/vst_console.h index c0fa954..18a7fa5 100644 --- a/includes/vst_console.h +++ b/includes/vst_console.h @@ -9,8 +9,7 @@ i16 conSizeXtemp, conSizeYtemp; i16 conMinSizeX, conMinSizeY; i16 conMaxSizeX, conMaxSizeY; CONSOLE_CURSOR_INFO cciOldCursor, cciNewCursor; -char szBuffer[4096]; -// char szBuffer[1024]; +wchar_t szBuffer[4096]; u32 BytesWritten; // Double-buffering structs @@ -25,286 +24,262 @@ COORD coordLargestWindowSize; BOOL fSuccess; void * -AllocateBackBuffer() -{ - if (chiBuffer != NULL) - { - free(chiBuffer); - } - void *chiBuffer = - (void *) malloc(sizeof(CHAR_INFO) * conMaxSizeX * conMaxSizeY * 2); - - return chiBuffer; +AllocateBackBuffer() { + if (chiBuffer != NULL) { + free(chiBuffer); + } + void *chiBuffer = + (void *) malloc(sizeof(CHAR_INFO) * conMaxSizeX * conMaxSizeY * 2); + + return chiBuffer; } void -SetConsoleHandles() -{ - hStdin = GetStdHandle(STD_INPUT_HANDLE); - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - hStderr = GetStdHandle(STD_ERROR_HANDLE); - hBackBuffer = CreateConsoleScreenBuffer( // - GENERIC_READ | GENERIC_WRITE, // read/write access - FILE_SHARE_READ | FILE_SHARE_WRITE, // shared - NULL, // default security attributes - CONSOLE_TEXTMODE_BUFFER, // must be TEXTMODE - NULL); // reserved; must be NULL +SetConsoleHandles() { + hStdin = GetStdHandle(STD_INPUT_HANDLE); + hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + hStderr = GetStdHandle(STD_ERROR_HANDLE); + hBackBuffer = CreateConsoleScreenBuffer( // + GENERIC_READ | GENERIC_WRITE, // read/write access + FILE_SHARE_READ | FILE_SHARE_WRITE, // shared + NULL, // default security attributes + CONSOLE_TEXTMODE_BUFFER, // must be TEXTMODE + NULL); // reserved; must be NULL } void -ScrollBuffer(HANDLE hConsole) -{ - SMALL_RECT ScrollRectangle, ClipRectangle; - COORD DestinationOrigin = { 0, 15 }; - CHAR_INFO Fill = { ' ' }; - - ScrollRectangle.Top = 0; - ScrollRectangle.Left = 0; - ScrollRectangle.Bottom = conMaxSizeY * 2 - 1; - ScrollRectangle.Right = conMaxSizeX - 1; - - ClipRectangle.Top = 0; - ClipRectangle.Left = 0; - ClipRectangle.Bottom = conMaxSizeY * 2 - 1; - ClipRectangle.Right = conMaxSizeX - 1; - - ScrollConsoleScreenBuffer( - hConsole, &ScrollRectangle, &ClipRectangle, DestinationOrigin, &Fill); +ScrollBuffer(HANDLE hConsole) { + SMALL_RECT ScrollRectangle, ClipRectangle; + COORD DestinationOrigin = { 0, 15 }; + CHAR_INFO Fill = { ' ' }; + + ScrollRectangle.Top = 0; + ScrollRectangle.Left = 0; + ScrollRectangle.Bottom = conMaxSizeY * 2 - 1; + ScrollRectangle.Right = conMaxSizeX - 1; + + ClipRectangle.Top = 0; + ClipRectangle.Left = 0; + ClipRectangle.Bottom = conMaxSizeY * 2 - 1; + ClipRectangle.Right = conMaxSizeX - 1; + + ScrollConsoleScreenBuffer( + hConsole, &ScrollRectangle, &ClipRectangle, DestinationOrigin, &Fill); } void -SetCursorPosition(HANDLE hConsole, u32 PositionX, u32 PositionY) -{ - COORD coordPosition; +SetCursorPosition(HANDLE hConsole, u32 PositionX, u32 PositionY) { + COORD coordPosition; - coordPosition.X = (i16) PositionX; - coordPosition.Y = (i16) PositionY; + coordPosition.X = (i16) PositionX; + coordPosition.Y = (i16) PositionY; - SetConsoleCursorPosition(hConsole, coordPosition); + SetConsoleCursorPosition(hConsole, coordPosition); } void -ResizeConsoleWindow(HANDLE hConsole, i16 Width, i16 Height) -{ - BOOL AbsolutePosition = FALSE; - SMALL_RECT NewSize; +ResizeConsoleWindow(HANDLE hConsole, i16 Width, i16 Height) { + BOOL AbsolutePosition = FALSE; + SMALL_RECT NewSize; - i16 ShiftX = 0; - i16 ShiftY = 0; + i16 ShiftX = 0; + i16 ShiftY = 0; - NewSize.Top = 0 + ShiftY; - NewSize.Left = 0 + ShiftX; - NewSize.Bottom = Height - 1 + ShiftY; - NewSize.Right = Width - 1 + ShiftX; + NewSize.Top = 0 + ShiftY; + NewSize.Left = 0 + ShiftX; + NewSize.Bottom = Height - 1 + ShiftY; + NewSize.Right = Width - 1 + ShiftX; - SetConsoleWindowInfo(hConsole, AbsolutePosition, &NewSize); + SetConsoleWindowInfo(hConsole, AbsolutePosition, &NewSize); } void GetConsoleWindowSize(HANDLE hConsole, i16 *conSizeX, i16 *conSizeY, - i16 *conMaxSizeX, i16 *conMaxSizeY) -{ - GetConsoleScreenBufferInfo(hConsole, &csbi); + i16 *conMaxSizeX, i16 *conMaxSizeY) { + GetConsoleScreenBufferInfo(hConsole, &csbi); - *conSizeX = csbi.srWindow.Right - csbi.srWindow.Left; - *conSizeY = csbi.srWindow.Bottom - csbi.srWindow.Top; + *conSizeX = csbi.srWindow.Right - csbi.srWindow.Left; + *conSizeY = csbi.srWindow.Bottom - csbi.srWindow.Top; - coordLargestWindowSize = GetLargestConsoleWindowSize(hConsole); + coordLargestWindowSize = GetLargestConsoleWindowSize(hConsole); - *conMaxSizeX = coordLargestWindowSize.X; - *conMaxSizeY = coordLargestWindowSize.Y; + *conMaxSizeX = coordLargestWindowSize.X; + *conMaxSizeY = coordLargestWindowSize.Y; } void HideConsoleCursor(HANDLE hConsole, CONSOLE_CURSOR_INFO *cciOldCursor, - CONSOLE_CURSOR_INFO *cciNewCursor) -{ - // Store the original cursor setting - GetConsoleCursorInfo(hConsole, cciOldCursor); + CONSOLE_CURSOR_INFO *cciNewCursor) { + // Store the original cursor setting + GetConsoleCursorInfo(hConsole, cciOldCursor); - // Set cursor to hidden - cciNewCursor->bVisible = FALSE; + // Set cursor to hidden + cciNewCursor->bVisible = FALSE; - SetConsoleCursorInfo(hConsole, cciNewCursor); + SetConsoleCursorInfo(hConsole, cciNewCursor); } void -WriteToBackBuffer(void) -{ - WriteConsole(hBackBuffer, szBuffer, strlen(szBuffer), &BytesWritten, NULL); +WriteToBackBuffer(void) { + WriteConsole(hBackBuffer, szBuffer, wcslen(szBuffer), &BytesWritten, NULL); } void -CopyFromBackBuffer() -{ - // Set the source rectangle. - srctReadRect.Top = 0; - srctReadRect.Left = 0; - srctReadRect.Bottom = conMaxSizeY * 2 - 1; - srctReadRect.Right = conMaxSizeX - 1; - - // The temporary buffer size - coordBufSize.X = conMaxSizeX; - coordBufSize.Y = conMaxSizeY * 2; - - // The top left destination cell of the temporary buffer - // is row 0, col 0. - coordBufCoord.X = 0; - coordBufCoord.Y = 0; - - // Copy the block from the screen buffer to the temporary buffer. - fSuccess = ReadConsoleOutput(hBackBuffer, // screen buffer to read from - chiBuffer, // buffer to copy into - coordBufSize, // col-row size of chiBuffer - coordBufCoord, // top left destination cell in chiBuffer - &srctReadRect); // screen buffer source rectangle - - if (!fSuccess) - { - fprintf(stderr, "ReadConsoleOutput failed - (%d)\n", GetLastError()); - return; - } - - // Set the destination rectangle. - srctWriteRect.Top = 0; - srctWriteRect.Left = 0; - srctWriteRect.Bottom = conMaxSizeY * 2 - 1; - srctWriteRect.Right = conMaxSizeX - 1; - - // Copy the temporary buffer to the new screen buffer. - fSuccess = WriteConsoleOutput(hStdout, // screen buffer to write to - chiBuffer, // buffer to copy from - coordBufSize, // col-row size of chiBuffer - coordBufCoord, // top left source coll in chiBuffer - &srctWriteRect); // destination screen buffer rectangle - - if (!fSuccess) - { - fprintf(stderr, "WriteConsoleOutput failed - (%d)\n", GetLastError()); - return; - } +CopyFromBackBuffer() { + // Set the source rectangle. + srctReadRect.Top = 0; + srctReadRect.Left = 0; + srctReadRect.Bottom = conMaxSizeY * 2 - 1; + srctReadRect.Right = conMaxSizeX - 1; + + // The temporary buffer size + coordBufSize.X = conMaxSizeX; + coordBufSize.Y = conMaxSizeY * 2; + + // The top left destination cell of the temporary buffer + // is row 0, col 0. + coordBufCoord.X = 0; + coordBufCoord.Y = 0; + + // Copy the block from the screen buffer to the temporary buffer. + fSuccess = ReadConsoleOutput(hBackBuffer, // screen buffer to read from + chiBuffer, // buffer to copy into + coordBufSize, // col-row size of chiBuffer + coordBufCoord, // top left destination cell in chiBuffer + &srctReadRect); // screen buffer source rectangle + + if (!fSuccess) { + fwprintf(stderr, L"ReadConsoleOutput failed - (%d)\n", GetLastError()); + return; + } + + // Set the destination rectangle. + srctWriteRect.Top = 0; + srctWriteRect.Left = 0; + srctWriteRect.Bottom = conMaxSizeY * 2 - 1; + srctWriteRect.Right = conMaxSizeX - 1; + + // Copy the temporary buffer to the new screen buffer. + fSuccess = WriteConsoleOutput(hStdout, // screen buffer to write to + chiBuffer, // buffer to copy from + coordBufSize, // col-row size of chiBuffer + coordBufCoord, // top left source coll in chiBuffer + &srctWriteRect); // destination screen buffer rectangle + + if (!fSuccess) { + fwprintf(stderr, L"WriteConsoleOutput failed - (%d)\n", GetLastError()); + return; + } } void -cls(HANDLE hConsole) -{ - COORD coordScreen = { 0, 0 }; // home for the cursor - u32 cCharsWritten; - CONSOLE_SCREEN_BUFFER_INFO csbi; - u32 dwConSize; - - // Get the number of character cells in the current buffer. - if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) - { - return; - } - - dwConSize = csbi.dwMaximumWindowSize.X * csbi.dwMaximumWindowSize.Y; - // dwConSize = csbi.dwSize.X * csbi.dwSize.Y; - - // Fill the entire screen with blanks - if (!FillConsoleOutputCharacter( // - hConsole, // Handle to the console screen buffer - (TCHAR) ' ', // character to write to the buffer - dwConSize, // number of cells to write - coordScreen, // coordinates of the first cell - &cCharsWritten)) // receive the number of characters written - { - return; - } - - // Get the current text attribute. - if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) - { - return; - } - - // Set the buffer's attributes accordingly. - if (!FillConsoleOutputAttribute( // - hConsole, // Handle to console screen buffer - csbi.wAttributes, // Character attributes to use - dwConSize, // Number of cells to set attribute - coordScreen, // Coordinates of first cell - &cCharsWritten)) // Receive number of characters written - { - return; - } - - // Put the cursor at its home coordinates. - SetConsoleCursorPosition(hConsole, coordScreen); +cls(HANDLE hConsole) { + COORD coordScreen = { 0, 0 }; // home for the cursor + u32 cCharsWritten; + CONSOLE_SCREEN_BUFFER_INFO csbi; + u32 dwConSize; + + // Get the number of character cells in the current buffer. + if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) { + return; + } + + dwConSize = csbi.dwMaximumWindowSize.X * csbi.dwMaximumWindowSize.Y; + // dwConSize = csbi.dwSize.X * csbi.dwSize.Y; + + // Fill the entire screen with blanks + if (!FillConsoleOutputCharacter( // + hConsole, // Handle to the console screen buffer + (TCHAR) ' ', // character to write to the buffer + dwConSize, // number of cells to write + coordScreen, // coordinates of the first cell + &cCharsWritten)) { // receive the number of characters written + return; + } + + // Get the current text attribute. + if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) { + return; + } + + // Set the buffer's attributes accordingly. + if (!FillConsoleOutputAttribute( // + hConsole, // Handle to console screen buffer + csbi.wAttributes, // Character attributes to use + dwConSize, // Number of cells to set attribute + coordScreen, // Coordinates of first cell + &cCharsWritten)) { // Receive number of characters written + return; + } + + // Put the cursor at its home coordinates. + SetConsoleCursorPosition(hConsole, coordScreen); } void -ChangeMode(HANDLE hConsole) -{ +ChangeMode(HANDLE hConsole) { - u32 conMode = 0x0; - SetConsoleMode(hConsole, conMode); + u32 conMode = 0x0; + SetConsoleMode(hConsole, conMode); } void -ClearLine() -{ - sprintf_s(szBuffer, _countof(szBuffer), "%*s\r", conSizeX - 1, ""); - WriteToBackBuffer(); +ClearLine() { + swprintf_s(szBuffer, _countof(szBuffer), L"%*s\r", conSizeX - 1, L""); + WriteToBackBuffer(); } void -WriteDebugMessage(HANDLE hConsole) -{ - static struct - { - u32 ConModeFlag; - char *ConModeName; - } ConModes[] = { { ENABLE_ECHO_INPUT, "ENABLE_ECHO_INPUT" }, - { ENABLE_INSERT_MODE, "ENABLE_INSERT_MODE" }, - { ENABLE_LINE_INPUT, "ENABLE_LINE_INPUT" }, - { ENABLE_MOUSE_INPUT, "ENABLE_MOUSE_INPUT" }, - { ENABLE_PROCESSED_INPUT, "ENABLE_PROCESSED_INPUT" }, - { ENABLE_QUICK_EDIT_MODE, "ENABLE_QUICK_EDIT_MODE" }, - { ENABLE_WINDOW_INPUT, "ENABLE_WINDOW_INPUT" }, - { ENABLE_VIRTUAL_TERMINAL_INPUT, "ENABLE_VIRTUAL_TERMINAL_INPUT" }, - { ENABLE_PROCESSED_OUTPUT, "ENABLE_PROCESSED_OUTPUT" }, - { ENABLE_WRAP_AT_EOL_OUTPUT, "ENABLE_WRAP_AT_EOL_OUTPUT" }, - { ENABLE_VIRTUAL_TERMINAL_PROCESSING, - "ENABLE_VIRTUAL_TERMINAL_PROCESSING" }, - { DISABLE_NEWLINE_AUTO_RETURN, "DISABLE_NEWLINE_AUTO_RETURN" }, - { ENABLE_LVB_GRID_WORLDWIDE, "ENABLE_LVB_GRID_WORLDWIDE" } }; - - u32 conMode; - char *szBuffer[1024]; - - GetConsoleMode(hConsole, &conMode); - - FILE *fpConModeInfo = fopen("debug/conmode.txt", "w"); - - fprintf(fpConModeInfo, "conMode: 0x%08lu\n", conMode); - for (int i = 0; i < _countof(ConModes); ++i) - { - if (ConModes[i].ConModeFlag & conMode) - { - fprintf(fpConModeInfo, "%s\n", ConModes[i].ConModeName); +WriteDebugMessage(HANDLE hConsole) { + static struct { + u32 ConModeFlag; + char *ConModeName; + } ConModes[] = { { ENABLE_ECHO_INPUT, "ENABLE_ECHO_INPUT" }, + { ENABLE_INSERT_MODE, "ENABLE_INSERT_MODE" }, + { ENABLE_LINE_INPUT, "ENABLE_LINE_INPUT" }, + { ENABLE_MOUSE_INPUT, "ENABLE_MOUSE_INPUT" }, + { ENABLE_PROCESSED_INPUT, "ENABLE_PROCESSED_INPUT" }, + { ENABLE_QUICK_EDIT_MODE, "ENABLE_QUICK_EDIT_MODE" }, + { ENABLE_WINDOW_INPUT, "ENABLE_WINDOW_INPUT" }, + { ENABLE_VIRTUAL_TERMINAL_INPUT, "ENABLE_VIRTUAL_TERMINAL_INPUT" }, + { ENABLE_PROCESSED_OUTPUT, "ENABLE_PROCESSED_OUTPUT" }, + { ENABLE_WRAP_AT_EOL_OUTPUT, "ENABLE_WRAP_AT_EOL_OUTPUT" }, + { ENABLE_VIRTUAL_TERMINAL_PROCESSING, + "ENABLE_VIRTUAL_TERMINAL_PROCESSING" }, + { DISABLE_NEWLINE_AUTO_RETURN, "DISABLE_NEWLINE_AUTO_RETURN" }, + { ENABLE_LVB_GRID_WORLDWIDE, "ENABLE_LVB_GRID_WORLDWIDE" } }; + + u32 conMode; + //char *szBuffer[1024]; not used??? + + GetConsoleMode(hConsole, &conMode); + + FILE *fpConModeInfo = fopen("debug/conmode.txt", "w"); + + fprintf(fpConModeInfo, "conMode: 0x%08lu\n", conMode); + for (int i = 0; i < _countof(ConModes); ++i) { + if (ConModes[i].ConModeFlag & conMode) { + fprintf(fpConModeInfo, "%s\n", ConModes[i].ConModeName); + } } - } #ifdef DEBUG - fprintf(fpConModeInfo, "Debug mode ON\n"); + fwprintf(fpConModeInfo, L"Debug mode ON\n"); #endif - fclose(fpConModeInfo); + fclose(fpConModeInfo); } void -WriteDebugLog(TCHAR *message) -{ - WriteTimeStampDebugString(); +WriteDebugLog(TCHAR *message) { + WriteTimeStampDebugString(); - FILE *fpDebugInfo = fopen("debug/debug.log", "a"); + FILE *fpDebugInfo = fopen("debug/debug.log", "a"); - fprintf(fpDebugInfo, szTimeStampDebug); - fprintf(fpDebugInfo, message); + fwprintf(fpDebugInfo, szTimeStampDebug); + fwprintf(fpDebugInfo, message); - fclose(fpDebugInfo); + fclose(fpDebugInfo); } #endif diff --git a/includes/vst_debug.h b/includes/vst_debug.h index de80602..6b086c9 100644 --- a/includes/vst_debug.h +++ b/includes/vst_debug.h @@ -2,23 +2,28 @@ #define _VST_DEBUG_H void -WriteDebugInfo(void) -{ - char szBuffer[1024]; +WriteDebugInfo(void) { + wchar_t szBuffer[1024]; - sprintf_s(szBuffer, _countof(szBuffer), "processBaseAddress: 0x%016llx\n", - processBaseAddress); - WriteDebugLog(szBuffer); + swprintf_s(szBuffer, _countof(szBuffer), L"processBaseAddress: 0x%016llx\n", + processBaseAddress); + WriteDebugLog(szBuffer); - // Maximum window dimensions - sprintf_s(szBuffer, _countof(szBuffer), "conMaxSizeX: %i, conMaxSizeY: %i\n", - conMaxSizeX, conMaxSizeY); - WriteDebugLog(szBuffer); + // Maximum window dimensions + swprintf_s(szBuffer, _countof(szBuffer), L"conMaxSizeX: %i, conMaxSizeY: %i\n", + conMaxSizeX, conMaxSizeY); + WriteDebugLog(szBuffer); - // Pointer to the back-buffer memory - sprintf_s( - szBuffer, _countof(szBuffer), "chiBuffer address: 0x%08p\n", chiBuffer); - WriteDebugLog(szBuffer); + // Pointer to the back-buffer memory + swprintf_s( + szBuffer, _countof(szBuffer), L"chiBuffer address: 0x%08p\n", chiBuffer); + WriteDebugLog(szBuffer); + + // Emulator memory base offset + //swprintf_s( + // szBuffer, _countof(szBuffer), "EmuBase address: 0x%08p\n", emuBaseAddress); + //WriteDebugLog(szBuffer); } -#endif \ No newline at end of file +#endif + diff --git a/includes/vst_emulation.h b/includes/vst_emulation.h index 105e89b..e9d6a2f 100644 --- a/includes/vst_emulation.h +++ b/includes/vst_emulation.h @@ -29,43 +29,45 @@ #define GAME_STATUS_USE_OPEN_DOOR 0x000b #define GAME_STATUS_END_OF_TURN 0x000c -char *GameStatusNameList[17] = { - "Normal", // 1 - "Battle", // 2 - "Cut-scene", // 3 - "???", // 4 - "Menu Screen", // 5 - "Quick Menu", // 6 - "First Person View", // 7 - "Activate Panel", // 8 - "Open Container", // 9 - "Draw Weapon", // 10 - "Use Locked Door", // 11 - "End of Turn", // 12 - "???", // 13 - "???", // 14 - "???", // 15 - "???", // 16 - "???" // 17 +wchar_t *GameStatusNameList[18] = { + L"???", + L"Normal", // 1 + L"Battle", // 2 + L"Cut-scene", // 3 + L"???", // 4 + L"Menu Screen", // 5 + L"Quick Menu", // 6 + L"First Person View", // 7 + L"Activate Panel", // 8 + L"Open Container", // 9 + L"Draw Weapon", // 10 + L"Use Locked Door", // 11 + L"End of Turn", // 12 + L"???", // 13 + L"???", // 14 + L"???", // 15 + L"???", // 16 + L"???" // 17 }; void -ReadGameStatus(u16 *GameStatus) -{ +ReadGameStatus(u16 *GameStatus) { usize BytesToRead = sizeof(u16); ReadGameMemory(processID, OFFSET_GAME_STATUS, BytesToRead, GameStatus); } void -PrintGameStatus(u16 *GameStatus) -{ - sprintf(szBuffer, "\nGAME STATUS:\n"); - WriteToBackBuffer(); +PrintGameStatus(u16 *GameStatus) { + //if (*GameStatus == 0) return; - sprintf(szBuffer, "#%d -- %s\n", *GameStatus, - GameStatusNameList[*GameStatus - 1]); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"\nGAME STATUS:\n"); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), L"#%d -- %s\n", *GameStatus, + GameStatusNameList[*GameStatus]); + WriteToBackBuffer(); } #endif + diff --git a/includes/vst_equipment.h b/includes/vst_equipment.h index 1a0bab6..e124013 100644 --- a/includes/vst_equipment.h +++ b/includes/vst_equipment.h @@ -47,197 +47,197 @@ #define OFFSET_WEAPON_AFFINITY_LIGHT 0x11fac1 #define OFFSET_WEAPON_AFFINITY_DARK 0x11fac2 -char *ItemNamesList[512] = { "", "Battle Knife", "Scramasax", "Dirk", - "Throwing Knife", "Kudi", "Cinquedea", "Kris", "Hatchet", "Khukuri", - "Baselard", "Stiletto", "Jamadhar", "Spatha", "Scimitar", "Rapier", - "Short Sword", "Firangi", "Shamshir", "Falchion", "Shotel", "Khora", - "Khopesh", "Wakizashi", "Rhomphaia", "Broad Sword", "Norse Sword", "Katana", - "Executioner", "Claymore", "Schiavona", "Bastard Sword", "Nodachi", - "Rune Blade", "Holy Win", "Hand Axe", "Battle Axe", "Francisca", "Tabarzin", - "Chamkaq", "Tabar", "Bullova", "Crescent", "Goblin Club", "Spiked Club", - "Ball Mace", "Footman\'s Mace", "Morning Star", "War Hammer", "Bec de Corbin", - "War Maul", "Guisarme", "Large Crescent", "Sabre Halberd", "Balbriggan", - "Double Blade", "Halberd", "Wizard Staff", "Clergy Rod", "Summoner Baton", - "Shamanic Staff", "Bishop\'s Crosier", "Sage\'s Cane", "Langdebeve", - "Sabre Mace", "Footman\'s Mace", "Gloomwing", "Mjolnir", "Griever", - "Destroyer", "Hand of Light", "Spear", "Glaive", "Scorpion", "Corcesca", - "Trident", "Awl Pike", "Boar Spear", "Fauchard", "Voulge", "Pole Axe", - "Bardysh", "Brandestoc", "Gastraph Bow", "Light Crossbow", "Target Bow", - "Windlass", "Cranequin", "Lug Crossbow", "Siege Bow", "Arbalest", "untitled", - "untitled", "untitled", "untitled", "untitled", "Short Hilt", "Swept Hilt", - "Cross Guard", "Knuckle Guard", "Counter Guard", "Side Ring", "Power Palm", - "Murderer\'s Hilt", "Spiral Hilt", "Wooden Grip", "Sand Face", "Czekan Type", - "Sarissa Grip", "Gendarme", "Heavy Grip", "Runkasyle", "Bhuj Type", - "Grimoire Grip", "Elephant", "Wooden Pole", "Spiculum Pole", "Winged Pole", - "Framea Pole", "Ahlspies", "Spiral Pole", "Simple Bolt", "Steel Bolt", - "Javelin Bolt", "Falarica Bolt", "Stone Bullet", "Sonic Bullet", "Buckler", - "Pelta Shield", "Targe", "Quad Shield", "Circle Shield", "Tower Shield", - "Spiked Shield", "Round Shield", "Kite Shield", "Casserole Shield", - "Heater Shield", "Oval Shield", "Knight Shield", "Hoplite Shield", - "Jazeraint Shield", "Dread Shield", "Bandana", "Bear Mask", "Wizard Hat", - "Bone Helm", "Chain Coif", "Spangenhelm", "Cabasset", "Sallet", "Barbut", - "Basinet", "Armet", "Close Helm", "Burgonet", "Hoplite Helm", - "Jazeraint Helm", "Dread Helm", "Jerkin", "Hauberk", "Wizard Robe", "Cuirass", - "Banded Mail", "Ring Mail", "Chain Mail", "Breastplate", "Segmentata", - "Scale Armor", "Brigandine", "Plate Mail", "Fluted Armor", "Hoplite Armor", - "Jazeraint Armor", "Dread Armor", "Sandals", "Boots", "Long Boots", "Cuisse", - "Light Greave", "Ring Leggings", "Chain Leggings", "Fusskampf", "Poleyn", - "Jambeau", "Missaglia", "Plate Leggings", "Fluted Leggings", - "Hoplite Leggings", "Jazeraint Leggings", "Dread Leggings", "Bandage", - "Leather Glove", "Reinforced Glove", "Knuckles", "Ring Sleeve", - "Chain Sleeve", "Gauntlet", "Vambrace", "Plate Glove", "Rondanche", - "Tilt Glove", "Freiturnier", "Fluted Glove", "Hoplite Glove", - "Jazeraint Glove", "Dread Glove", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "Rood Necklace", "Rune Earrings", "Lionhead", "Rusted Nails", - "Sylphid Ring", "Marduk", "Salamander Ring", "Tamulis Tongue", - "Gnome Bracelet", "Palolo\'s Ring", "Undine Bracelet", "Talian Ring", - "Agrias\'s Balm", "Kadesh Ring", "Agrippa\'s Choker", "Diadra\'s Earring", - "Titan\'s Ring", "Lau Fei\'s Armlet", "Swan Song", "Pushpaka", - "Edgar\'s Earrings", "Cross Choker", "Ghost Hound", "Beaded Anklet", - "Dragonhead", "Faufnir\'s Tear", "Agales\'s Chain", "Balam Ring", - "Nimje Coif", "Morgan\'s Nails", "Marlene\'s Ring", "Wood", "Leather", - "Bronze", "Iron", "Hagane", "Silver", "Damascus", "Talos Feldspar", - "Titan Malachite", "Sylphid Topaz", "Djinn Amber", "Salamander Ruby", - "Ifrit Carnelian", "Gnome Emerald", "Dao Moonstone", "Undine Jasper", - "Marid Aquamarine", "Angel Pearl", "Seraphim Diamond", "Morlock Jet", - "Berial Blackpearl", "Haeralis", "Orlandu", "Orion", "Ogmius", "Iocus", - "Balvus", "Trinity", "Beowulf", "Dragonite", "Sigguld", "Demonia", "Altema", - "Polaris", "Basivalen", "Galerian", "Vedivier", "Berion", "Gervin", "Tertia", - "Lancer", "Arturos", "Braveheart", "Hellraiser", "Nightkiller", "Manabreaker", - "Powerfist", "Brainshield", "Speedster", "untitled", "Silent Queen", - "Dark Queen", "Death Queen", "White Queen", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "Cure Root", "Cure Bulb", "Cure Tonic", "Cure Potion", - "Mana Root", "Mana Bulb", "Mana Tonic", "Mana Potion", "Vera Root", - "Vera Bulb", "Vera Tonic", "Vera Potion", "Acolyte\'s Nostrum", - "Saint\'s Nostrum", "Alchemist\'s Reagent", "Sorcerer\'s Reagent", - "Yggdrasil\'s Tears", "Faerie Chortle", "Spirit Orison", "Angelic Paean", - "Panacea", "Snowfly Draught", "Faerie Wing", "Elixir of Kings", - "Elixir of Sages", "Elixir of Dragoons", "Elixir of Queens", - "Elixir of Mages", "Valens", "Prudens", "Volare", "Audentia", "Virtus", - "Eye of Argon", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "Grimoire Zephyr", "Grimoire Teslae", "Grimoire Incendie", "Grimoire Terre", - "Grimoire Glace", "Grimoire Lux", "Grimoire Patir", "Grimoire Exsorcer", - "Grimoire Banish", "Grimoire Demolir", "untitled", "untitled", "untitled", - "Grimoire Foudre", "untitled", "untitled", "untitled", "Grimoire Flamme", - "untitled", "untitled", "untitled", "Grimoire Gaea", "untitled", "untitled", - "untitled", "Grimoire Avalanche", "untitled", "untitled", "untitled", - "Grimoire Radius", "untitled", "untitled", "untitled", "Grimoire Meteore", - "untitled", "untitled", "untitled", "Grimoire Egout", "Grimoire Demance", - "Grimoire Guerir", "Grimoire Mollesse", "Grimoire Antidote", "Grimoire Benir", - "Grimoire Purifier", "Grimoire Vie", "Grimoire Intensite", "Grimoire Debile", - "Grimoire Eclairer", "Grimoire Nuageux", "Grimoire Agilite", - "Grimoire Tardif", "Grimoire Ameliorer", "Grimoire Deteriorer", - "Grimoire Muet", "Grimoire Annuler", "Grimoire Paralysie", "Grimoire Venin", - "Grimoire Fleau", "Grimoire Halte", "Grimoire Dissiper", "Grimoire Clef", - "Grimoire Visible", "Grimoire Analyse", "Grimoire Sylphe", - "Grimoire Salamandre", "Grimoire Gnome", "Grimoire Undine", - "Grimoire Parebrise", "Grimoire Ignifuge", "Grimoire Rempart", - "Grimoire Barrer", "untitled", "Bronze Key", "Iron Key", "Silver Key", - "Gold Key", "Platinum Key", "Steel Key", "Crimson Key", "Chest Key", - "Chamomile Sigil", "Lily Sigil", "Tearose Sigil", "Clematis Sigil", - "Hyacinth Sigil", "Fern Sigil", "Aster Sigil", "Eulelia Sigil", - "Melissa Sigil", "Calla Sigil", "Laurel Sigil", "Acacia Sigil", "Palm Sigil", - "Kalmia Sigil", "Colombine Sigil", "Anemone Sigil", "Verbena Sigil", - "Schirra Sigil", "Marigold Sigil", "Azalea Sigil", "Tigertail Sigil", - "Stock Sigil", "Cattleya Sigil", "Mandrake Sigil", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled" }; - -char *ArmorsList[81] = { "", "Buckler", "Pelta Shield", "Targe", "Quad Shield", - "Circle Shield", "Tower Shield", "Spiked Shield", "Round Shield", - "Kite Shield", "Casserole Shield", "Heater Shield", "Oval Shield", - "Knight Shield", "Hoplite Shield", "Jazeraint Shield", "Dread Shield", - "Bandana", "Bear Mask", "Wizard Hat", "Bone Helm", "Chain Coif", - "Spangenhelm", "Cabasset", "Sallet", "Barbut", "Basinet", "Armet", - "Close Helm", "Burgonet", "Hoplite Helm", "Jazeraint Helm", "Dread Helm", - "Jerkin", "Hauberk", "Wizard Robe", "Cuirass", "Banded Mail", "Ring Mail", - "Chain Mail", "Breastplate", "Segmentata", "Scale Armor", "Brigandine", - "Plate Mail", "Fluted Armor", "Hoplite Armor", "Jazeraint Armor", - "Dread Armor", "Sandals", "Boots", "Long Boots", "Cuisse", "Light Greave", - "Ring Leggings", "Chain Leggings", "Fusskampf", "Poleyn", "Jambeau", - "Missaglia", "Plate Leggings", "Fluted Leggings", "Hoplite Leggings", - "Jazeraint Leggings", "Dread Leggings", "Bandage", "Leather Glove", - "Reinforced Glove", "Knuckles", "Ring Sleeve", "Chain Sleeve", "Gauntlet", - "Vambrace", "Plate Glove", "Rondanche", "Tilt Glove", "Freiturnier", - "Fluted Glove", "Hoplite Glove", "Jazeraint Glove", "Dread Glove" }; - -char *WeaponsList[91] = { "", "Battle Knife", "Scramasax", "Dirk", - "Throwing Knife", "Kudi", "Cinquedea", "Kris", "Hatchet", "Khukuri", - "Baselard", "Stiletto", "Jamadhar", "Spatha", "Scimitar", "Rapier", - "Short Sword", "Firangi", "Shamshir", "Falchion", "Shotel", "Khora", - "Khopesh", "Wakizashi", "Rhomphaia", "Broad Sword", "Norse Sword", "Katana", - "Executioner", "Claymore", "Schiavona", "Bastard Sword", "Nodachi", - "Rune Blade", "Holy Win", "Hand Axe", "Battle Axe", "Francisca", "Tabarzin", - "Chamkaq", "Tabar", "Bullova", "Crescent", "Goblin Club", "Spiked Club", - "Ball Mace", "Footman\'s Mace", "Morning Star", "War Hammer", "Bec de Corbin", - "War Maul", "Guisarme", "Large Crescent", "Sabre Halberd", "Balbriggan", - "Double Blade", "Halberd", "Wizard Staff", "Clergy Rod", "Summoner Baton", - "Shamanic Staff", "Bishop\'s Crosier", "Sage\'s Cane", "Langdebeve", - "Sabre Mace", "Footman\'s Mace", "Gloomwing", "Mjolnir", "Griever", - "Destroyer", "Hand of Light", "Spear", "Glaive", "Scorpion", "Corcesca", - "Trident", "Awl Pike", "Boar Spear", "Fauchard", "Voulge", "Pole Axe", - "Bardysh", "Brandestoc", "Gastraph Bow", "Light Crossbow", "Target Bow", - "Windlass", "Cranequin", "Lug Crossbow", "Siege Bow", "Arbalest" }; +wchar_t *ItemNamesList[512] = { L"", L"Battle Knife", L"Scramasax", L"Dirk", + L"Throwing Knife", L"Kudi", L"Cinquedea", L"Kris", L"Hatchet", L"Khukuri", + L"Baselard", L"Stiletto", L"Jamadhar", L"Spatha", L"Scimitar", L"Rapier", + L"Short Sword", L"Firangi", L"Shamshir", L"Falchion", L"Shotel", L"Khora", + L"Khopesh", L"Wakizashi", L"Rhomphaia", L"Broad Sword", L"Norse Sword", L"Katana", + L"Executioner", L"Claymore", L"Schiavona", L"Bastard Sword", L"Nodachi", + L"Rune Blade", L"Holy Win", L"Hand Axe", L"Battle Axe", L"Francisca", L"Tabarzin", + L"Chamkaq", L"Tabar", L"Bullova", L"Crescent", L"Goblin Club", L"Spiked Club", + L"Ball Mace", L"Footman\'s Mace", L"Morning Star", L"War Hammer", L"Bec de Corbin", + L"War Maul", L"Guisarme", L"Large Crescent", L"Sabre Halberd", L"Balbriggan", + L"Double Blade", L"Halberd", L"Wizard Staff", L"Clergy Rod", L"Summoner Baton", + L"Shamanic Staff", L"Bishop\'s Crosier", L"Sage\'s Cane", L"Langdebeve", + L"Sabre Mace", L"Footman\'s Mace", L"Gloomwing", L"Mjolnir", L"Griever", + L"Destroyer", L"Hand of Light", L"Spear", L"Glaive", L"Scorpion", L"Corcesca", + L"Trident", L"Awl Pike", L"Boar Spear", L"Fauchard", L"Voulge", L"Pole Axe", + L"Bardysh", L"Brandestoc", L"Gastraph Bow", L"Light Crossbow", L"Target Bow", + L"Windlass", L"Cranequin", L"Lug Crossbow", L"Siege Bow", L"Arbalest", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"Short Hilt", L"Swept Hilt", + L"Cross Guard", L"Knuckle Guard", L"Counter Guard", L"Side Ring", L"Power Palm", + L"Murderer\'s Hilt", L"Spiral Hilt", L"Wooden Grip", L"Sand Face", L"Czekan Type", + L"Sarissa Grip", L"Gendarme", L"Heavy Grip", L"Runkasyle", L"Bhuj Type", + L"Grimoire Grip", L"Elephant", L"Wooden Pole", L"Spiculum Pole", L"Winged Pole", + L"Framea Pole", L"Ahlspies", L"Spiral Pole", L"Simple Bolt", L"Steel Bolt", + L"Javelin Bolt", L"Falarica Bolt", L"Stone Bullet", L"Sonic Bullet", L"Buckler", + L"Pelta Shield", L"Targe", L"Quad Shield", L"Circle Shield", L"Tower Shield", + L"Spiked Shield", L"Round Shield", L"Kite Shield", L"Casserole Shield", + L"Heater Shield", L"Oval Shield", L"Knight Shield", L"Hoplite Shield", + L"Jazeraint Shield", L"Dread Shield", L"Bandana", L"Bear Mask", L"Wizard Hat", + L"Bone Helm", L"Chain Coif", L"Spangenhelm", L"Cabasset", L"Sallet", L"Barbut", + L"Basinet", L"Armet", L"Close Helm", L"Burgonet", L"Hoplite Helm", + L"Jazeraint Helm", L"Dread Helm", L"Jerkin", L"Hauberk", L"Wizard Robe", L"Cuirass", + L"Banded Mail", L"Ring Mail", L"Chain Mail", L"Breastplate", L"Segmentata", + L"Scale Armor", L"Brigandine", L"Plate Mail", L"Fluted Armor", L"Hoplite Armor", + L"Jazeraint Armor", L"Dread Armor", L"Sandals", L"Boots", L"Long Boots", L"Cuisse", + L"Light Greave", L"Ring Leggings", L"Chain Leggings", L"Fusskampf", L"Poleyn", + L"Jambeau", L"Missaglia", L"Plate Leggings", L"Fluted Leggings", + L"Hoplite Leggings", L"Jazeraint Leggings", L"Dread Leggings", L"Bandage", + L"Leather Glove", L"Reinforced Glove", L"Knuckles", L"Ring Sleeve", + L"Chain Sleeve", L"Gauntlet", L"Vambrace", L"Plate Glove", L"Rondanche", + L"Tilt Glove", L"Freiturnier", L"Fluted Glove", L"Hoplite Glove", + L"Jazeraint Glove", L"Dread Glove", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"Rood Necklace", L"Rune Earrings", L"Lionhead", L"Rusted Nails", + L"Sylphid Ring", L"Marduk", L"Salamander Ring", L"Tamulis Tongue", + L"Gnome Bracelet", L"Palolo\'s Ring", L"Undine Bracelet", L"Talian Ring", + L"Agrias\'s Balm", L"Kadesh Ring", L"Agrippa\'s Choker", L"Diadra\'s Earring", + L"Titan\'s Ring", L"Lau Fei\'s Armlet", L"Swan Song", L"Pushpaka", + L"Edgar\'s Earrings", L"Cross Choker", L"Ghost Hound", L"Beaded Anklet", + L"Dragonhead", L"Faufnir\'s Tear", L"Agales\'s Chain", L"Balam Ring", + L"Nimje Coif", L"Morgan\'s Nails", L"Marlene\'s Ring", L"Wood", L"Leather", + L"Bronze", L"Iron", L"Hagane", L"Silver", L"Damascus", L"Talos Feldspar", + L"Titan Malachite", L"Sylphid Topaz", L"Djinn Amber", L"Salamander Ruby", + L"Ifrit Carnelian", L"Gnome Emerald", L"Dao Moonstone", L"Undine Jasper", + L"Marid Aquamarine", L"Angel Pearl", L"Seraphim Diamond", L"Morlock Jet", + L"Berial Blackpearl", L"Haeralis", L"Orlandu", L"Orion", L"Ogmius", L"Iocus", + L"Balvus", L"Trinity", L"Beowulf", L"Dragonite", L"Sigguld", L"Demonia", L"Altema", + L"Polaris", L"Basivalen", L"Galerian", L"Vedivier", L"Berion", L"Gervin", L"Tertia", + L"Lancer", L"Arturos", L"Braveheart", L"Hellraiser", L"Nightkiller", L"Manabreaker", + L"Powerfist", L"Brainshield", L"Speedster", L"untitled", L"Silent Queen", + L"Dark Queen", L"Death Queen", L"White Queen", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"Cure Root", L"Cure Bulb", L"Cure Tonic", L"Cure Potion", + L"Mana Root", L"Mana Bulb", L"Mana Tonic", L"Mana Potion", L"Vera Root", + L"Vera Bulb", L"Vera Tonic", L"Vera Potion", L"Acolyte\'s Nostrum", + L"Saint\'s Nostrum", L"Alchemist\'s Reagent", L"Sorcerer\'s Reagent", + L"Yggdrasil\'s Tears", L"Faerie Chortle", L"Spirit Orison", L"Angelic Paean", + L"Panacea", L"Snowfly Draught", L"Faerie Wing", L"Elixir of Kings", + L"Elixir of Sages", L"Elixir of Dragoons", L"Elixir of Queens", + L"Elixir of Mages", L"Valens", L"Prudens", L"Volare", L"Audentia", L"Virtus", + L"Eye of Argon", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"Grimoire Zephyr", L"Grimoire Teslae", L"Grimoire Incendie", L"Grimoire Terre", + L"Grimoire Glace", L"Grimoire Lux", L"Grimoire Patir", L"Grimoire Exsorcer", + L"Grimoire Banish", L"Grimoire Demolir", L"untitled", L"untitled", L"untitled", + L"Grimoire Foudre", L"untitled", L"untitled", L"untitled", L"Grimoire Flamme", + L"untitled", L"untitled", L"untitled", L"Grimoire Gaea", L"untitled", L"untitled", + L"untitled", L"Grimoire Avalanche", L"untitled", L"untitled", L"untitled", + L"Grimoire Radius", L"untitled", L"untitled", L"untitled", L"Grimoire Meteore", + L"untitled", L"untitled", L"untitled", L"Grimoire Egout", L"Grimoire Demance", + L"Grimoire Guerir", L"Grimoire Mollesse", L"Grimoire Antidote", L"Grimoire Benir", + L"Grimoire Purifier", L"Grimoire Vie", L"Grimoire Intensite", L"Grimoire Debile", + L"Grimoire Eclairer", L"Grimoire Nuageux", L"Grimoire Agilite", + L"Grimoire Tardif", L"Grimoire Ameliorer", L"Grimoire Deteriorer", + L"Grimoire Muet", L"Grimoire Annuler", L"Grimoire Paralysie", L"Grimoire Venin", + L"Grimoire Fleau", L"Grimoire Halte", L"Grimoire Dissiper", L"Grimoire Clef", + L"Grimoire Visible", L"Grimoire Analyse", L"Grimoire Sylphe", + L"Grimoire Salamandre", L"Grimoire Gnome", L"Grimoire Undine", + L"Grimoire Parebrise", L"Grimoire Ignifuge", L"Grimoire Rempart", + L"Grimoire Barrer", L"untitled", L"Bronze Key", L"Iron Key", L"Silver Key", + L"Gold Key", L"Platinum Key", L"Steel Key", L"Crimson Key", L"Chest Key", + L"Chamomile Sigil", L"Lily Sigil", L"Tearose Sigil", L"Clematis Sigil", + L"Hyacinth Sigil", L"Fern Sigil", L"Aster Sigil", L"Eulelia Sigil", + L"Melissa Sigil", L"Calla Sigil", L"Laurel Sigil", L"Acacia Sigil", L"Palm Sigil", + L"Kalmia Sigil", L"Colombine Sigil", L"Anemone Sigil", L"Verbena Sigil", + L"Schirra Sigil", L"Marigold Sigil", L"Azalea Sigil", L"Tigertail Sigil", + L"Stock Sigil", L"Cattleya Sigil", L"Mandrake Sigil", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled" }; + +wchar_t *ArmorsList[81] = { L"", L"Buckler", L"Pelta Shield", L"Targe", L"Quad Shield", + L"Circle Shield", L"Tower Shield", L"Spiked Shield", L"Round Shield", + L"Kite Shield", L"Casserole Shield", L"Heater Shield", L"Oval Shield", + L"Knight Shield", L"Hoplite Shield", L"Jazeraint Shield", L"Dread Shield", + L"Bandana", L"Bear Mask", L"Wizard Hat", L"Bone Helm", L"Chain Coif", + L"Spangenhelm", L"Cabasset", L"Sallet", L"Barbut", L"Basinet", L"Armet", + L"Close Helm", L"Burgonet", L"Hoplite Helm", L"Jazeraint Helm", L"Dread Helm", + L"Jerkin", L"Hauberk", L"Wizard Robe", L"Cuirass", L"Banded Mail", L"Ring Mail", + L"Chain Mail", L"Breastplate", L"Segmentata", L"Scale Armor", L"Brigandine", + L"Plate Mail", L"Fluted Armor", L"Hoplite Armor", L"Jazeraint Armor", + L"Dread Armor", L"Sandals", L"Boots", L"Long Boots", L"Cuisse", L"Light Greave", + L"Ring Leggings", L"Chain Leggings", L"Fusskampf", L"Poleyn", L"Jambeau", + L"Missaglia", L"Plate Leggings", L"Fluted Leggings", L"Hoplite Leggings", + L"Jazeraint Leggings", L"Dread Leggings", L"Bandage", L"Leather Glove", + L"Reinforced Glove", L"Knuckles", L"Ring Sleeve", L"Chain Sleeve", L"Gauntlet", + L"Vambrace", L"Plate Glove", L"Rondanche", L"Tilt Glove", L"Freiturnier", + L"Fluted Glove", L"Hoplite Glove", L"Jazeraint Glove", L"Dread Glove" }; + +wchar_t *WeaponsList[91] = { L"", L"Battle Knife", L"Scramasax", L"Dirk", + L"Throwing Knife", L"Kudi", L"Cinquedea", L"Kris", L"Hatchet", L"Khukuri", + L"Baselard", L"Stiletto", L"Jamadhar", L"Spatha", L"Scimitar", L"Rapier", + L"Short Sword", L"Firangi", L"Shamshir", L"Falchion", L"Shotel", L"Khora", + L"Khopesh", L"Wakizashi", L"Rhomphaia", L"Broad Sword", L"Norse Sword", L"Katana", + L"Executioner", L"Claymore", L"Schiavona", L"Bastard Sword", L"Nodachi", + L"Rune Blade", L"Holy Win", L"Hand Axe", L"Battle Axe", L"Francisca", L"Tabarzin", + L"Chamkaq", L"Tabar", L"Bullova", L"Crescent", L"Goblin Club", L"Spiked Club", + L"Ball Mace", L"Footman\'s Mace", L"Morning Star", L"War Hammer", L"Bec de Corbin", + L"War Maul", L"Guisarme", L"Large Crescent", L"Sabre Halberd", L"Balbriggan", + L"Double Blade", L"Halberd", L"Wizard Staff", L"Clergy Rod", L"Summoner Baton", + L"Shamanic Staff", L"Bishop\'s Crosier", L"Sage\'s Cane", L"Langdebeve", + L"Sabre Mace", L"Footman\'s Mace", L"Gloomwing", L"Mjolnir", L"Griever", + L"Destroyer", L"Hand of Light", L"Spear", L"Glaive", L"Scorpion", L"Corcesca", + L"Trident", L"Awl Pike", L"Boar Spear", L"Fauchard", L"Voulge", L"Pole Axe", + L"Bardysh", L"Brandestoc", L"Gastraph Bow", L"Light Crossbow", L"Target Bow", + L"Windlass", L"Cranequin", L"Lug Crossbow", L"Siege Bow", L"Arbalest" }; // The first element of this array should start at index 97 (0x61), // so make adjustments in a funcions reading it. -char *AccessoriesList[31] = { "Rood Necklace", "Rune Earrings", "Lionhead", - "Rusted Nails", "Sylphid Ring", "Marduk", "Salamander Ring", "Tamulis Tongue", - "Gnome Bracelet", "Palolo\'s Ring", "Undine Bracelet", "Talian Ring", - "Agrias\'s Balm", "Kadesh Ring", "Agrippa\'s Choker", "Diadra\'s Earring", - "Titan\'s Ring", "Lau Fei\'s Armlet", "Swan Song", "Pushpaka", - "Edgar\'s Earrings", "Cross Choker", "Ghost Hound", "Beaded Anklet", - "Dragonhead", "Faufnir\'s Tear", "Agales\'s Chain", "Balam Ring", - "Nimje Coif", "Morgan\'s Nails", "Marlene\'s Ring" }; - -char *GripsList[32] = { "", "Short Hilt", "Swept Hilt", "Cross Guard", - "Knuckle Guard", "Counter Guard", "Side Ring", "Power Palm", - "Murderer's Hilt", "Spiral Hilt", "Wooden Grip", "Sand Face", "Czekan Type", - "Sarissa Grip", "Gendarme", "Heavy Grip", "Runkasyle", "Bhuj Type", - "Grimoire Grip", "Elephant", "Wooden Pole", "Spiculum Pole", "Winged Pole", - "Framea Pole", "Ahlspies", "Spiral Pole", "Simple Bolt", "Steel Bolt", - "Javelin Bolt", "Falarica Bolt", "Stone Bullet", "Sonic Bullet" }; - -char *GemsList[63] = { "None", "Talos Feldspar", "Titan Malachite", - "Sylphid Topaz", "Djinn Amber", "Salamander Ruby", "Ifrit Carnelian", - "Gnome Emerald", "Dao Moonstone", "Undine Jasper", "Marid Aquamarine", - "Angel Pearl", "Seraphim Diamond", "Morlock Jet", "Berial Blackpearl", - "Haeralis", "Orlandu", "Orion", "Ogmius", "Iocus", "Balvus", "Trinity", - "Beowulf", "Dragonite", "Sigguld", "Demonia", "Altema", "Polaris", - "Basivalen", "Galerian", "Vedivier", "Berion", "Gervin", "Tertia", "Lancer", - "Arturos", "Braveheart", "Hellraiser", "Nightkiller", "Manabreaker", - "Powerfist", "Brainshield", "Speedster", "untitled", "Silent Queen", - "Dark Queen", "Death Queen", "White Queen", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled", "untitled", "untitled", "untitled", "untitled", "untitled", - "untitled" }; - -char *ArmorsCategories[8] = { "", "Shield", "Helm", "Breast Armor", "Leggings", - "Glove", "unused", "Accessory" }; - -char *WeaponsCategories[11] = { "", "Daggers", "Swords", "Great Swords", - "Axes & Maces", "Great Axes", "Staves", "Heavy Maces", "Polearms", - "Crossbows", "Bare Hands" }; - -char *WeaponDamageType[4] = { "", "Blunt", "Edged", "Piercing" }; - -char *WeaponAttackCostType[6] = { "", "MP", "RISK", "HP", "PP", "nothing" }; - -char *CraftingMaterials[8] = { "", "Wood", "Leather", "Bronze", "Iron", - "Hagane", "Silver", "Damascus" }; - -char *ItemClass[10] = { "", "Warrior's ", "Knightly ", "Prestigious ", "Brave ", - "Warlord ", "Champion ", "Glorious ", "Supreme ", "Divine " }; +wchar_t *AccessoriesList[31] = { L"Rood Necklace", L"Rune Earrings", L"Lionhead", + L"Rusted Nails", L"Sylphid Ring", L"Marduk", L"Salamander Ring", L"Tamulis Tongue", + L"Gnome Bracelet", L"Palolo\'s Ring", L"Undine Bracelet", L"Talian Ring", + L"Agrias\'s Balm", L"Kadesh Ring", L"Agrippa\'s Choker", L"Diadra\'s Earring", + L"Titan\'s Ring", L"Lau Fei\'s Armlet", L"Swan Song", L"Pushpaka", + L"Edgar\'s Earrings", L"Cross Choker", L"Ghost Hound", L"Beaded Anklet", + L"Dragonhead", L"Faufnir\'s Tear", L"Agales\'s Chain", L"Balam Ring", + L"Nimje Coif", L"Morgan\'s Nails", L"Marlene\'s Ring" }; + +wchar_t *GripsList[32] = { L"", L"Short Hilt", L"Swept Hilt", L"Cross Guard", + L"Knuckle Guard", L"Counter Guard", L"Side Ring", L"Power Palm", + L"Murderer's Hilt", L"Spiral Hilt", L"Wooden Grip", L"Sand Face", L"Czekan Type", + L"Sarissa Grip", L"Gendarme", L"Heavy Grip", L"Runkasyle", L"Bhuj Type", + L"Grimoire Grip", L"Elephant", L"Wooden Pole", L"Spiculum Pole", L"Winged Pole", + L"Framea Pole", L"Ahlspies", L"Spiral Pole", L"Simple Bolt", L"Steel Bolt", + L"Javelin Bolt", L"Falarica Bolt", L"Stone Bullet", L"Sonic Bullet" }; + +wchar_t *GemsList[63] = { L"None", L"Talos Feldspar", L"Titan Malachite", + L"Sylphid Topaz", L"Djinn Amber", L"Salamander Ruby", L"Ifrit Carnelian", + L"Gnome Emerald", L"Dao Moonstone", L"Undine Jasper", L"Marid Aquamarine", + L"Angel Pearl", L"Seraphim Diamond", L"Morlock Jet", L"Berial Blackpearl", + L"Haeralis", L"Orlandu", L"Orion", L"Ogmius", L"Iocus", L"Balvus", L"Trinity", + L"Beowulf", L"Dragonite", L"Sigguld", L"Demonia", L"Altema", L"Polaris", + L"Basivalen", L"Galerian", L"Vedivier", L"Berion", L"Gervin", L"Tertia", L"Lancer", + L"Arturos", L"Braveheart", L"Hellraiser", L"Nightkiller", L"Manabreaker", + L"Powerfist", L"Brainshield", L"Speedster", L"untitled", L"Silent Queen", + L"Dark Queen", L"Death Queen", L"White Queen", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", L"untitled", + L"untitled" }; + +wchar_t *ArmorsCategories[8] = { L"", L"Shield", L"Helm", L"Breast Armor", L"Leggings", + L"Glove", L"unused", L"Accessory" }; + +wchar_t *WeaponsCategories[11] = { L"", L"Daggers", L"Swords", L"Great Swords", + L"Axes & Maces", L"Great Axes", L"Staves", L"Heavy Maces", L"Polearms", + L"Crossbows", L"Bare Hands" }; + +wchar_t *WeaponDamageType[4] = { L"", L"Blunt", L"Edged", L"Piercing" }; + +wchar_t *WeaponAttackCostType[6] = { L"", L"MP", L"RISK", L"HP", L"PP", L"nothing" }; + +wchar_t *CraftingMaterials[8] = { L"", L"Wood", L"Leather", L"Bronze", L"Iron", + L"Hagane", L"Silver", L"Damascus" }; + +wchar_t *ItemClass[10] = { L"", L"Warrior's ", L"Knightly ", L"Prestigious ", L"Brave ", + L"Warlord ", L"Champion ", L"Glorious ", L"Supreme ", L"Divine " }; #define LEVELING_FLAG_HUMAN 0x0001 #define LEVELING_FLAG_BEAST 0x0002 @@ -254,1603 +254,1435 @@ char *ItemClass[10] = { "", "Warrior's ", "Knightly ", "Prestigious ", "Brave ", #define LEVELING_FLAG_DARK 0x1000 void -ClearLevelingFlags() -{ - LevelingFlags.Flags.FlagsCompound = 0; +ClearLevelingFlags() { + LevelingFlags.Flags.FlagsCompound = 0; } void -UpdateLevelingFlags() -{ - ClearLevelingFlags(); - - i8 HumanCur = itemBladeCur.ClassHuman; - i8 BeastCur = itemBladeCur.ClassBeast; - i8 UndeadCur = itemBladeCur.ClassUndead; - i8 PhantomCur = itemBladeCur.ClassPhantom; - i8 DragonCur = itemBladeCur.ClassDragon; - i8 EvilCur = itemBladeCur.ClassEvil; - i8 PhysicalCur = itemBladeCur.AffinityPhysical; - i8 AirCur = itemBladeCur.AffinityAir; - i8 FireCur = itemBladeCur.AffinityFire; - i8 EarthCur = itemBladeCur.AffinityEarth; - i8 WaterCur = itemBladeCur.AffinityWater; - i8 LightCur = itemBladeCur.AffinityLight; - i8 DarkCur = itemBladeCur.AffinityDark; - - i8 HumanPrev = itemBladePrev.ClassHuman; - i8 BeastPrev = itemBladePrev.ClassBeast; - i8 UndeadPrev = itemBladePrev.ClassUndead; - i8 PhantomPrev = itemBladePrev.ClassPhantom; - i8 DragonPrev = itemBladePrev.ClassDragon; - i8 EvilPrev = itemBladePrev.ClassEvil; - i8 PhysicalPrev = itemBladePrev.AffinityPhysical; - i8 AirPrev = itemBladePrev.AffinityAir; - i8 FirePrev = itemBladePrev.AffinityFire; - i8 EarthPrev = itemBladePrev.AffinityEarth; - i8 WaterPrev = itemBladePrev.AffinityWater; - i8 LightPrev = itemBladePrev.AffinityLight; - i8 DarkPrev = itemBladePrev.AffinityDark; - - i8 HumanDiff = HumanCur - HumanPrev; - i8 BeastDiff = BeastCur - BeastPrev; - i8 UndeadDiff = UndeadCur - UndeadPrev; - i8 PhantomDiff = PhantomCur - PhantomPrev; - i8 DragonDiff = DragonCur - DragonPrev; - i8 EvilDiff = EvilCur - EvilPrev; - i8 PhysicalDiff = PhysicalCur - PhysicalPrev; - i8 AirDiff = AirCur - AirPrev; - i8 FireDiff = FireCur - FirePrev; - i8 EarthDiff = EarthCur - EarthPrev; - i8 WaterDiff = WaterCur - WaterPrev; - i8 LightDiff = LightCur - LightPrev; - i8 DarkDiff = DarkCur - DarkPrev; - - if (HumanDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_HUMAN; - } - if (BeastDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_BEAST; - } - if (UndeadDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_UNDEAD; - } - if (PhantomDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_PHANTOM; - } - if (DragonDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_DRAGON; - } - if (EvilDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_EVIL; - } - if (PhysicalDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_PHYSICAL; - } - if (AirDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_AIR; - } - if (FireDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_FIRE; - } - if (EarthDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_EARTH; - } - if (WaterDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_WATER; - } - if (LightDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_LIGHT; - } - if (DarkDiff) - { - LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_DARK; - } +UpdateLevelingFlags() { + ClearLevelingFlags(); + + i8 HumanCur = itemBladeCur.ClassHuman; + i8 BeastCur = itemBladeCur.ClassBeast; + i8 UndeadCur = itemBladeCur.ClassUndead; + i8 PhantomCur = itemBladeCur.ClassPhantom; + i8 DragonCur = itemBladeCur.ClassDragon; + i8 EvilCur = itemBladeCur.ClassEvil; + i8 PhysicalCur = itemBladeCur.AffinityPhysical; + i8 AirCur = itemBladeCur.AffinityAir; + i8 FireCur = itemBladeCur.AffinityFire; + i8 EarthCur = itemBladeCur.AffinityEarth; + i8 WaterCur = itemBladeCur.AffinityWater; + i8 LightCur = itemBladeCur.AffinityLight; + i8 DarkCur = itemBladeCur.AffinityDark; + + i8 HumanPrev = itemBladePrev.ClassHuman; + i8 BeastPrev = itemBladePrev.ClassBeast; + i8 UndeadPrev = itemBladePrev.ClassUndead; + i8 PhantomPrev = itemBladePrev.ClassPhantom; + i8 DragonPrev = itemBladePrev.ClassDragon; + i8 EvilPrev = itemBladePrev.ClassEvil; + i8 PhysicalPrev = itemBladePrev.AffinityPhysical; + i8 AirPrev = itemBladePrev.AffinityAir; + i8 FirePrev = itemBladePrev.AffinityFire; + i8 EarthPrev = itemBladePrev.AffinityEarth; + i8 WaterPrev = itemBladePrev.AffinityWater; + i8 LightPrev = itemBladePrev.AffinityLight; + i8 DarkPrev = itemBladePrev.AffinityDark; + + i8 HumanDiff = HumanCur - HumanPrev; + i8 BeastDiff = BeastCur - BeastPrev; + i8 UndeadDiff = UndeadCur - UndeadPrev; + i8 PhantomDiff = PhantomCur - PhantomPrev; + i8 DragonDiff = DragonCur - DragonPrev; + i8 EvilDiff = EvilCur - EvilPrev; + i8 PhysicalDiff = PhysicalCur - PhysicalPrev; + i8 AirDiff = AirCur - AirPrev; + i8 FireDiff = FireCur - FirePrev; + i8 EarthDiff = EarthCur - EarthPrev; + i8 WaterDiff = WaterCur - WaterPrev; + i8 LightDiff = LightCur - LightPrev; + i8 DarkDiff = DarkCur - DarkPrev; + + if (HumanDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_HUMAN; + if (BeastDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_BEAST; + if (UndeadDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_UNDEAD; + if (PhantomDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_PHANTOM; + if (DragonDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_DRAGON; + if (EvilDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_EVIL; + if (PhysicalDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_PHYSICAL; + if (AirDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_AIR; + if (FireDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_FIRE; + if (EarthDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_EARTH; + if (WaterDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_WATER; + if (LightDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_LIGHT; + if (DarkDiff) LevelingFlags.Flags.FlagsCompound |= LEVELING_FLAG_DARK; } void -ReadBladeData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_WEAPON_BLADE, BytesToRead, &itemBladeCur); +ReadBladeData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_WEAPON_BLADE, BytesToRead, &itemBladeCur); } void -ReadWeaponData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; - - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_WEAPON_GRIP, BytesToRead, &itemGripCur); - - // Weapon gems - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT1, - BytesToRead, &itemGem1WeaponCur); - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT2, - BytesToRead, &itemGem2WeaponCur); - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT3, - BytesToRead, &itemGem3WeaponCur); +ReadWeaponData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; + + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_WEAPON_GRIP, BytesToRead, &itemGripCur); + + // Weapon gems + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT1, + BytesToRead, &itemGem1WeaponCur); + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT2, + BytesToRead, &itemGem2WeaponCur); + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_WEAPON_GEM_SLOT3, + BytesToRead, &itemGem3WeaponCur); } void -ReadShieldData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; - - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_SHIELD, BytesToRead, &itemShieldCur); - - // Shield gems - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT1, - BytesToRead, &itemGem1ShieldCur); - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT2, - BytesToRead, &itemGem2ShieldCur); - BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT3, - BytesToRead, &itemGem3ShieldCur); +ReadShieldData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; + + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_SHIELD, BytesToRead, &itemShieldCur); + + // Shield gems + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT1, + BytesToRead, &itemGem1ShieldCur); + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT2, + BytesToRead, &itemGem2ShieldCur); + BytesRead = ReadGameMemory(processID, OFFSET_EQUIPPED_SHIELD_GEM_SLOT3, + BytesToRead, &itemGem3ShieldCur); } void -ReadGlovesData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; - - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_LEFT_ARM, BytesToRead, &itemGloveLeftCur); - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_RIGHT_ARM, BytesToRead, &itemGloveRightCur); +ReadGlovesData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; + + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_LEFT_ARM, BytesToRead, &itemGloveLeftCur); + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_RIGHT_ARM, BytesToRead, &itemGloveRightCur); } void -ReadHeadData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; +ReadHeadData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_HEAD, BytesToRead, &itemHeadCur); + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_HEAD, BytesToRead, &itemHeadCur); } void -ReadBodyData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; +ReadBodyData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_BODY, BytesToRead, &itemBodyCur); + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_BODY, BytesToRead, &itemBodyCur); } void -ReadLegsData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; +ReadLegsData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_LEGS, BytesToRead, &itemLegsCur); + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_LEGS, BytesToRead, &itemLegsCur); } void -ReadNeckData() -{ - usize BytesToRead = sizeof(item_data); - usize BytesRead; +ReadNeckData() { + usize BytesToRead = sizeof(item_data); + usize BytesRead; - BytesRead = ReadGameMemory( - processID, OFFSET_EQUIPPED_NECK, BytesToRead, &itemNeckCur); + BytesRead = ReadGameMemory( + processID, OFFSET_EQUIPPED_NECK, BytesToRead, &itemNeckCur); } void -ReadArmorData() -{ - ReadGlovesData(); - ReadBodyData(); - ReadHeadData(); - ReadLegsData(); - ReadNeckData(); +ReadArmorData() { + ReadGlovesData(); + ReadBodyData(); + ReadHeadData(); + ReadLegsData(); + ReadNeckData(); } BOOL -ItemDataChanged(item_data *Item1, item_data *Item2) -{ - usize DataSize = sizeof(item_data); +ItemDataChanged(item_data *Item1, item_data *Item2) { + usize DataSize = sizeof(item_data); - BOOL Result = DataChanged((void *) Item1, (void *) Item2, DataSize); + BOOL Result = DataChanged((void *) Item1, (void *) Item2, DataSize); - return Result; + return Result; } BOOL -BladeDataChanged() -{ - if (ItemDataChanged(&itemBladePrev, &itemBladeCur)) - { - return TRUE; - } - return FALSE; +BladeDataChanged() { + if (ItemDataChanged(&itemBladePrev, &itemBladeCur)) + { + return TRUE; + } + return FALSE; } BOOL -WeaponDataChanged() -{ - if (ItemDataChanged(&itemGripPrev, &itemGripCur) || - ItemDataChanged(&itemGem1WeaponPrev, &itemGem1WeaponCur) || - ItemDataChanged(&itemGem2WeaponPrev, &itemGem2WeaponCur) || - ItemDataChanged(&itemGem3WeaponPrev, &itemGem3WeaponCur)) - { - return TRUE; - } - return FALSE; +WeaponDataChanged() { + if (ItemDataChanged(&itemGripPrev, &itemGripCur) || + ItemDataChanged(&itemGem1WeaponPrev, &itemGem1WeaponCur) || + ItemDataChanged(&itemGem2WeaponPrev, &itemGem2WeaponCur) || + ItemDataChanged(&itemGem3WeaponPrev, &itemGem3WeaponCur)) + { + return TRUE; + } + return FALSE; } BOOL -ShieldDataChanged() -{ - if (ItemDataChanged(&itemShieldPrev, &itemShieldCur) || - ItemDataChanged(&itemGem1ShieldPrev, &itemGem1ShieldCur) || - ItemDataChanged(&itemGem2ShieldPrev, &itemGem2ShieldCur) || - ItemDataChanged(&itemGem3ShieldPrev, &itemGem3ShieldCur)) - { - return TRUE; - } - return FALSE; +ShieldDataChanged() { + if (ItemDataChanged(&itemShieldPrev, &itemShieldCur) || + ItemDataChanged(&itemGem1ShieldPrev, &itemGem1ShieldCur) || + ItemDataChanged(&itemGem2ShieldPrev, &itemGem2ShieldCur) || + ItemDataChanged(&itemGem3ShieldPrev, &itemGem3ShieldCur)) + { + return TRUE; + } + return FALSE; } BOOL -ArmorDataChanged() -{ - if (ItemDataChanged(&itemGloveLeftPrev, &itemGloveLeftCur) || - ItemDataChanged(&itemGloveRightPrev, &itemGloveRightCur) || - ItemDataChanged(&itemHeadPrev, &itemHeadCur) || - ItemDataChanged(&itemBodyPrev, &itemBodyCur) || - ItemDataChanged(&itemLegsPrev, &itemLegsCur) || - ItemDataChanged(&itemNeckPrev, &itemNeckCur)) - { - return TRUE; - } - return FALSE; +ArmorDataChanged() { + if (ItemDataChanged(&itemGloveLeftPrev, &itemGloveLeftCur) || + ItemDataChanged(&itemGloveRightPrev, &itemGloveRightCur) || + ItemDataChanged(&itemHeadPrev, &itemHeadCur) || + ItemDataChanged(&itemBodyPrev, &itemBodyCur) || + ItemDataChanged(&itemLegsPrev, &itemLegsCur) || + ItemDataChanged(&itemNeckPrev, &itemNeckCur)) + { + return TRUE; + } + return FALSE; } void -PrintBladeLeveling(u8 BladeNumber) -{ - - i8 HumanCur = itemBladeCur.ClassHuman; - i8 BeastCur = itemBladeCur.ClassBeast; - i8 UndeadCur = itemBladeCur.ClassUndead; - i8 PhantomCur = itemBladeCur.ClassPhantom; - i8 DragonCur = itemBladeCur.ClassDragon; - i8 EvilCur = itemBladeCur.ClassEvil; - i8 PhysicalCur = itemBladeCur.AffinityPhysical; - i8 AirCur = itemBladeCur.AffinityAir; - i8 FireCur = itemBladeCur.AffinityFire; - i8 EarthCur = itemBladeCur.AffinityEarth; - i8 WaterCur = itemBladeCur.AffinityWater; - i8 LightCur = itemBladeCur.AffinityLight; - i8 DarkCur = itemBladeCur.AffinityDark; - - i8 HumanFlag = LevelingFlags.Flags.Human; - i8 BeastFlag = LevelingFlags.Flags.Beast; - i8 UndeadFlag = LevelingFlags.Flags.Undead; - i8 PhantomFlag = LevelingFlags.Flags.Phantom; - i8 DragonFlag = LevelingFlags.Flags.Dragon; - i8 EvilFlag = LevelingFlags.Flags.Evil; - i8 PhysicalFlag = LevelingFlags.Flags.Physical; - i8 AirFlag = LevelingFlags.Flags.Air; - i8 FireFlag = LevelingFlags.Flags.Fire; - i8 EarthFlag = LevelingFlags.Flags.Earth; - i8 WaterFlag = LevelingFlags.Flags.Water; - i8 LightFlag = LevelingFlags.Flags.Light; - i8 DarkFlag = LevelingFlags.Flags.Dark; - - switch (BladeNumber) - { - case 1: - { - sprintf_s(szBuffer, _countof(szBuffer), "\n\n== BLADE 1 ==\n\n"); - WriteToBackBuffer(); - - if (DragonCur == 100) - { - sprintf_s( - szBuffer, _countof(szBuffer), "Dragon: %4i OK\n", DragonCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Dragon: %4i %s\n", DragonCur, - DragonFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (PhysicalCur == 100) - { - - sprintf_s( - szBuffer, _countof(szBuffer), "Physical: %4i OK\n", PhysicalCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Physical: %4i %s\n", - PhysicalCur, PhysicalFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (BeastCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Beast: %4i OK\n", BeastCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Beast: %4i %s\n", BeastCur, - BeastFlag ? "++" : ""); - } - WriteToBackBuffer(); - - break; +PrintBladeLeveling(u8 BladeNumber) { + + i8 HumanCur = itemBladeCur.ClassHuman; + i8 BeastCur = itemBladeCur.ClassBeast; + i8 UndeadCur = itemBladeCur.ClassUndead; + i8 PhantomCur = itemBladeCur.ClassPhantom; + i8 DragonCur = itemBladeCur.ClassDragon; + i8 EvilCur = itemBladeCur.ClassEvil; + i8 PhysicalCur = itemBladeCur.AffinityPhysical; + i8 AirCur = itemBladeCur.AffinityAir; + i8 FireCur = itemBladeCur.AffinityFire; + i8 EarthCur = itemBladeCur.AffinityEarth; + i8 WaterCur = itemBladeCur.AffinityWater; + i8 LightCur = itemBladeCur.AffinityLight; + i8 DarkCur = itemBladeCur.AffinityDark; + + i8 HumanFlag = LevelingFlags.Flags.Human; + i8 BeastFlag = LevelingFlags.Flags.Beast; + i8 UndeadFlag = LevelingFlags.Flags.Undead; + i8 PhantomFlag = LevelingFlags.Flags.Phantom; + i8 DragonFlag = LevelingFlags.Flags.Dragon; + i8 EvilFlag = LevelingFlags.Flags.Evil; + i8 PhysicalFlag = LevelingFlags.Flags.Physical; + i8 AirFlag = LevelingFlags.Flags.Air; + i8 FireFlag = LevelingFlags.Flags.Fire; + i8 EarthFlag = LevelingFlags.Flags.Earth; + i8 WaterFlag = LevelingFlags.Flags.Water; + i8 LightFlag = LevelingFlags.Flags.Light; + i8 DarkFlag = LevelingFlags.Flags.Dark; + + switch (BladeNumber) { + case 1: + { + swprintf_s(szBuffer, _countof(szBuffer), L"\n\n== BLADE 1 ==\n\n"); + WriteToBackBuffer(); + + if (DragonCur == 100) { + swprintf_s( + szBuffer, _countof(szBuffer), L"Dragon: %4i OK\n", DragonCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Dragon: %4i %s\n", DragonCur, + DragonFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (PhysicalCur == 100) { + swprintf_s( + szBuffer, _countof(szBuffer), L"Physical: %4i OK\n", PhysicalCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Physical: %4i %s\n", + PhysicalCur, PhysicalFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (BeastCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Beast: %4i OK\n", BeastCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Beast: %4i %s\n", BeastCur, + BeastFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + break; + } + + case 2: + { + swprintf_s(szBuffer, _countof(szBuffer), L"\n\n== BLADE 2 ==\n\n"); + WriteToBackBuffer(); + + if (PhantomCur == 100) { + swprintf_s( + szBuffer, _countof(szBuffer), L"Phantom: %4i OK\n", PhantomCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Phantom: %4i %s\n", PhantomCur, + PhantomFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (HumanCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Human: %4i OK\n", HumanCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Human: %4i %s\n", HumanCur, + HumanFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (EarthCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Earth: %4i OK\n", EarthCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Earth: %4i %s\n", EarthCur, + EarthFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (DarkCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Dark: %4i OK\n", DarkCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Dark: %4i %s\n", DarkCur, + DarkFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (WaterCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Water: %4i OK\n", WaterCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Water: %4i %s\n", WaterCur, + WaterFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + break; + } + + case 3: + { + swprintf_s(szBuffer, _countof(szBuffer), L"\n\n== BLADE 3 ==\n\n"); + WriteToBackBuffer(); + + if (FireCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Fire: %4i OK\n", FireCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Fire: %4i %s\n", FireCur, + FireFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (AirCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Air: %4i OK\n", AirCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Air: %4i %s\n", AirCur, + AirFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + break; + } + + case 4: + { + swprintf_s(szBuffer, _countof(szBuffer), L"\n\n== BLADE 4 ==\n\n"); + WriteToBackBuffer(); + + if (UndeadCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Undead: %4i OK\n", UndeadCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Undead: %4i %s\n", UndeadCur, + UndeadFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (EvilCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Evil: %4i OK\n", EvilCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Evil: %4i %s\n", EvilCur, + EvilFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + if (LightCur == 100) { + swprintf_s(szBuffer, _countof(szBuffer), L"Light: %4i OK\n", LightCur); + } else { + swprintf_s(szBuffer, _countof(szBuffer), L"Light: %4i %s\n", LightCur, + LightFlag ? L"++" : L""); + } + WriteToBackBuffer(); + + break; + } + + default: + { + swprintf_s( + szBuffer, _countof(szBuffer), L"\nNo leveling weapon equipped\n\n"); + WriteToBackBuffer(); + } } +} - case 2: +void +WriteBladeLeveling(u8 BladeNumber) { + + i8 HumanCur = itemBladeCur.ClassHuman; + i8 BeastCur = itemBladeCur.ClassBeast; + i8 UndeadCur = itemBladeCur.ClassUndead; + i8 PhantomCur = itemBladeCur.ClassPhantom; + i8 DragonCur = itemBladeCur.ClassDragon; + i8 EvilCur = itemBladeCur.ClassEvil; + i8 PhysicalCur = itemBladeCur.AffinityPhysical; + i8 AirCur = itemBladeCur.AffinityAir; + i8 FireCur = itemBladeCur.AffinityFire; + i8 EarthCur = itemBladeCur.AffinityEarth; + i8 WaterCur = itemBladeCur.AffinityWater; + i8 LightCur = itemBladeCur.AffinityLight; + i8 DarkCur = itemBladeCur.AffinityDark; + + i8 HumanFlag = LevelingFlags.Flags.Human; + i8 BeastFlag = LevelingFlags.Flags.Beast; + i8 UndeadFlag = LevelingFlags.Flags.Undead; + i8 PhantomFlag = LevelingFlags.Flags.Phantom; + i8 DragonFlag = LevelingFlags.Flags.Dragon; + i8 EvilFlag = LevelingFlags.Flags.Evil; + i8 PhysicalFlag = LevelingFlags.Flags.Physical; + i8 AirFlag = LevelingFlags.Flags.Air; + i8 FireFlag = LevelingFlags.Flags.Fire; + i8 EarthFlag = LevelingFlags.Flags.Earth; + i8 WaterFlag = LevelingFlags.Flags.Water; + i8 LightFlag = LevelingFlags.Flags.Light; + i8 DarkFlag = LevelingFlags.Flags.Dark; + + FILE *fpBladeLeveling = fopen("game_data/weapon/blade_leveling.txt", "w"); + + switch (BladeNumber) { - sprintf_s(szBuffer, _countof(szBuffer), "\n\n== BLADE 2 ==\n\n"); - WriteToBackBuffer(); - - if (PhantomCur == 100) - { - - sprintf_s( - szBuffer, _countof(szBuffer), "Phantom: %4i OK\n", PhantomCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Phantom: %4i %s\n", PhantomCur, - PhantomFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (HumanCur == 100) - { - sprintf_s(szBuffer, _countof(szBuffer), "Human: %4i OK\n", HumanCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Human: %4i %s\n", HumanCur, - HumanFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (EarthCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Earth: %4i OK\n", EarthCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Earth: %4i %s\n", EarthCur, - EarthFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (DarkCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Dark: %4i OK\n", DarkCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Dark: %4i %s\n", DarkCur, - DarkFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (WaterCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Water: %4i OK\n", WaterCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Water: %4i %s\n", WaterCur, - WaterFlag ? "++" : ""); - } - WriteToBackBuffer(); - - break; + case 1: + { + fwprintf(fpBladeLeveling, L"== BLADE 1 ==\n\n"); + + if (DragonCur == 100) { + fwprintf(fpBladeLeveling, L"Dragon: %4i OK\n", DragonCur); + } else { + fwprintf(fpBladeLeveling, L"Dragon: %4i %s\n", DragonCur, + DragonFlag ? L"++" : L""); + } + + if (PhysicalCur == 100) { + fwprintf(fpBladeLeveling, L"Physical: %4i OK\n", PhysicalCur); + } else { + fwprintf(fpBladeLeveling, L"Physical: %4i %s\n", PhysicalCur, + PhysicalFlag ? L"++" : L""); + } + + if (BeastCur == 100) { + fwprintf(fpBladeLeveling, L"Beast: %4i OK\n", BeastCur); + } else { + fwprintf(fpBladeLeveling, L"Beast: %4i %s\n", BeastCur, + BeastFlag ? L"++" : L""); + } + + break; + } + + case 2: + { + fwprintf(fpBladeLeveling, L"== BLADE 2 ==\n\n"); + + if (PhantomCur == 100) { + fwprintf(fpBladeLeveling, L"Phantom: %4i OK\n", PhantomCur); + } else { + fwprintf(fpBladeLeveling, L"Phantom: %4i %s\n", PhantomCur, + PhantomFlag ? L"++" : L""); + } + + if (HumanCur == 100) { + fwprintf(fpBladeLeveling, L"Human: %4i OK\n", HumanCur); + } else { + fwprintf(fpBladeLeveling, L"Human: %4i %s\n", HumanCur, + HumanFlag ? L"++" : L""); + } + + if (EarthCur == 100) { + fwprintf(fpBladeLeveling, L"Earth: %4i OK\n", EarthCur); + } else { + fwprintf(fpBladeLeveling, L"Earth: %4i %s\n", EarthCur, + EarthFlag ? L"++" : L""); + } + + if (DarkCur == 100) { + fwprintf(fpBladeLeveling, L"Dark: %4i OK\n", DarkCur); + } else { + fwprintf(fpBladeLeveling, L"Dark: %4i %s\n", DarkCur, + DarkFlag ? L"++" : L""); + } + + if (WaterCur == 100) { + fwprintf(fpBladeLeveling, L"Water: %4i OK\n", WaterCur); + } else { + fwprintf(fpBladeLeveling, L"Water: %4i %s\n", WaterCur, + WaterFlag ? L"++" : L""); + } + + break; + } + + case 3: + { + fwprintf(fpBladeLeveling, L"== BLADE 3 ==\n\n"); + + if (FireCur == 100) { + fwprintf(fpBladeLeveling, L"Fire: %4i OK\n", FireCur); + } else { + fwprintf( + fpBladeLeveling, L"Fire: %4i %s\n", FireCur, FireFlag ? L"++" : L""); + } + + if (AirCur == 100) { + fwprintf(fpBladeLeveling, L"Air: %4i OK\n", AirCur); + } else { + fwprintf(fpBladeLeveling, L"Air: %4i %s\n", AirCur, AirFlag ? L"++" : L""); + } + + break; + } + + case 4: + { + fwprintf(fpBladeLeveling, L"== BLADE 4 ==\n\n"); + + if (UndeadCur == 100) { + fwprintf(fpBladeLeveling, L"Undead: %4i OK\n", UndeadCur); + } else { + fwprintf(fpBladeLeveling, L"Undead: %4i %s\n", UndeadCur, + UndeadFlag ? L"++" : L""); + } + + if (EvilCur == 100) { + fwprintf(fpBladeLeveling, L"Evil: %4i OK\n", EvilCur); + } else { + fwprintf( + fpBladeLeveling, L"Evil: %4i %s\n", EvilCur, EvilFlag ? L"++" : L""); + } + + if (LightCur == 100) { + fwprintf(fpBladeLeveling, L"Light: %4i OK\n", LightCur); + } else { + fwprintf(fpBladeLeveling, L"Light: %4i %s\n", LightCur, + LightFlag ? L"++" : L""); + } + break; + } + + default: + { + fwprintf(fpBladeLeveling, L"No leveling weapon equipped\n"); + } } + fclose(fpBladeLeveling); +} - case 3: +void +WriteBladeData() { + // Check for out-of-bound indexes + if (itemBladeCur.NamesListPosition > _countof(ItemNamesList) - 1 || // + itemBladeCur.ListPosition > _countof(WeaponsList) - 1 || // + itemBladeCur.Category > _countof(WeaponsCategories) - 1) { - sprintf_s(szBuffer, _countof(szBuffer), "\n\n== BLADE 3 ==\n\n"); - WriteToBackBuffer(); - - if (FireCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Fire: %4i OK\n", FireCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Fire: %4i %s\n", FireCur, - FireFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (AirCur == 100) - { - sprintf_s(szBuffer, _countof(szBuffer), "Air: %4i OK\n", AirCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Air: %4i %s\n", AirCur, - AirFlag ? "++" : ""); - } - WriteToBackBuffer(); - - break; + return; } - case 4: - { - sprintf_s(szBuffer, _countof(szBuffer), "\n\n== BLADE 4 ==\n\n"); - WriteToBackBuffer(); - - if (UndeadCur == 100) - { - - sprintf_s(szBuffer, _countof(szBuffer), "Undead: %4i OK\n", UndeadCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Undead: %4i %s\n", UndeadCur, - UndeadFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (EvilCur == 100) - { - sprintf_s(szBuffer, _countof(szBuffer), "Evil: %4i OK\n", EvilCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Evil: %4i %s\n", EvilCur, - EvilFlag ? "++" : ""); - } - WriteToBackBuffer(); - - if (LightCur == 100) - { - sprintf_s(szBuffer, _countof(szBuffer), "Light: %4i OK\n", LightCur); - } - else - { - sprintf_s(szBuffer, _countof(szBuffer), "Light: %4i %s\n", LightCur, - LightFlag ? "++" : ""); - } - WriteToBackBuffer(); - - break; - } + FILE *fpBladeData = fopen("game_data/weapon/blade.txt", "w"); - default: - { - sprintf_s( - szBuffer, _countof(szBuffer), "\nNo leveling weapon equipped\n\n"); - WriteToBackBuffer(); + // Check if weapon is eqipped + if (itemBladeCur.ListPosition == 0) { + fwprintf( + fpBladeData, L"Can't read the blade data: weapon is not equipped!\n"); + fclose(fpBladeData); + + return; } - } + + fwprintf(fpBladeData, L"Blade Stats\n\n"); + + fwprintf(fpBladeData, L"Name: %s\n", WeaponsList[itemBladeCur.ListPosition]); + fwprintf( + fpBladeData, L"Category: %s\n", WeaponsCategories[itemBladeCur.Category]); + fwprintf( + fpBladeData, L"Material: %s\n", CraftingMaterials[itemBladeCur.Material]); + fwprintf(fpBladeData, L"Damage type: %s\n", + WeaponDamageType[itemBladeCur.DamageType]); + fwprintf(fpBladeData, L"\n"); + + // Bonuses + fwprintf(fpBladeData, L"BONUSES\n"); + fwprintf(fpBladeData, L"========\n"); + fwprintf(fpBladeData, L"STR: %3i\n", itemBladeCur.STR); + fwprintf(fpBladeData, L"INT: %3i\n", itemBladeCur.INT); + fwprintf(fpBladeData, L"AGL: %3i\n", itemBladeCur.AGL); + fwprintf(fpBladeData, L"\n"); + + // DP & PP + fwprintf(fpBladeData, L"DURABILITY\n"); + fwprintf(fpBladeData, L"===========\n"); + fwprintf(fpBladeData, L"DP: %3i/%3i\n", (itemBladeCur.DPCur + 99) / 100, + (itemBladeCur.DPMax + 99) / 100); + fwprintf(fpBladeData, L"PP: %3i/%3i\n", itemBladeCur.PPCur, itemBladeCur.PPMax); + fwprintf(fpBladeData, L"\n"); + + // Misc + fwprintf(fpBladeData, L"MISC\n"); + fwprintf(fpBladeData, L"=======================\n"); + + // Range + fwprintf(fpBladeData, L"Range (x/y/z): %2i/%2i/%2i\n", itemBladeCur.Range.x, + itemBladeCur.Range.y, itemBladeCur.Range.z); + + // Resource cost + fwprintf(fpBladeData, L"Attack cost: %i %s\n", itemBladeCur.StatsCostValue, + WeaponAttackCostType[itemBladeCur.StatsCostType]); + fwprintf(fpBladeData, L"\n"); + + // Class + fwprintf(fpBladeData, L"CLASS\n"); + fwprintf(fpBladeData, L"=============\n"); + fwprintf(fpBladeData, L"Human: %3i\n", itemBladeCur.ClassHuman); + fwprintf(fpBladeData, L"Beast: %3i\n", itemBladeCur.ClassBeast); + fwprintf(fpBladeData, L"Undead: %3i\n", itemBladeCur.ClassUndead); + fwprintf(fpBladeData, L"Phantom: %3i\n", itemBladeCur.ClassPhantom); + fwprintf(fpBladeData, L"Dragon: %3i\n", itemBladeCur.ClassDragon); + fwprintf(fpBladeData, L"Evil: %3i\n", itemBladeCur.ClassEvil); + fwprintf(fpBladeData, L"\n"); + + // Affinity + fwprintf(fpBladeData, L"AFFINITY\n"); + fwprintf(fpBladeData, L"=============\n"); + fwprintf(fpBladeData, L"Physical: %3i\n", itemBladeCur.AffinityPhysical); + fwprintf(fpBladeData, L"Air: %3i\n", itemBladeCur.AffinityAir); + fwprintf(fpBladeData, L"Fire: %3i\n", itemBladeCur.AffinityFire); + fwprintf(fpBladeData, L"Earth: %3i\n", itemBladeCur.AffinityEarth); + fwprintf(fpBladeData, L"Water: %3i\n", itemBladeCur.AffinityWater); + fwprintf(fpBladeData, L"Light: %3i\n", itemBladeCur.AffinityLight); + fwprintf(fpBladeData, L"Dark: %3i\n", itemBladeCur.AffinityDark); + + fclose(fpBladeData); } void -WriteBladeLeveling(u8 BladeNumber) -{ - - i8 HumanCur = itemBladeCur.ClassHuman; - i8 BeastCur = itemBladeCur.ClassBeast; - i8 UndeadCur = itemBladeCur.ClassUndead; - i8 PhantomCur = itemBladeCur.ClassPhantom; - i8 DragonCur = itemBladeCur.ClassDragon; - i8 EvilCur = itemBladeCur.ClassEvil; - i8 PhysicalCur = itemBladeCur.AffinityPhysical; - i8 AirCur = itemBladeCur.AffinityAir; - i8 FireCur = itemBladeCur.AffinityFire; - i8 EarthCur = itemBladeCur.AffinityEarth; - i8 WaterCur = itemBladeCur.AffinityWater; - i8 LightCur = itemBladeCur.AffinityLight; - i8 DarkCur = itemBladeCur.AffinityDark; - - i8 HumanFlag = LevelingFlags.Flags.Human; - i8 BeastFlag = LevelingFlags.Flags.Beast; - i8 UndeadFlag = LevelingFlags.Flags.Undead; - i8 PhantomFlag = LevelingFlags.Flags.Phantom; - i8 DragonFlag = LevelingFlags.Flags.Dragon; - i8 EvilFlag = LevelingFlags.Flags.Evil; - i8 PhysicalFlag = LevelingFlags.Flags.Physical; - i8 AirFlag = LevelingFlags.Flags.Air; - i8 FireFlag = LevelingFlags.Flags.Fire; - i8 EarthFlag = LevelingFlags.Flags.Earth; - i8 WaterFlag = LevelingFlags.Flags.Water; - i8 LightFlag = LevelingFlags.Flags.Light; - i8 DarkFlag = LevelingFlags.Flags.Dark; - - FILE *fpBladeLeveling = fopen("game_data/weapon/blade_leveling.txt", "w"); - - switch (BladeNumber) - { - case 1: +WriteWeaponData() { + // Check for out-of-bound indexes + if (itemBladeCur.NamesListPosition > _countof(ItemNamesList) - 1 || // + itemBladeCur.ListPosition > _countof(WeaponsList) - 1 || // + itemBladeCur.Category > _countof(WeaponsCategories) - 1 || // + itemBladeCur.Material > _countof(CraftingMaterials) - 1 || // + itemGripCur.ListPosition > _countof(GripsList) - 1 || // + itemGem1WeaponCur.ListPosition > _countof(GemsList) - 1 || // + itemGem2WeaponCur.ListPosition > _countof(GemsList) - 1 || // + itemGem3WeaponCur.ListPosition > _countof(GemsList) - 1) { - fprintf(fpBladeLeveling, "== BLADE 1 ==\n\n"); - - if (DragonCur == 100) - { - fprintf(fpBladeLeveling, "Dragon: %4i OK\n", DragonCur); - } - else - { - fprintf(fpBladeLeveling, "Dragon: %4i %s\n", DragonCur, - DragonFlag ? "++" : ""); - } - - if (PhysicalCur == 100) - { - fprintf(fpBladeLeveling, "Physical: %4i OK\n", PhysicalCur); - } - else - { - fprintf(fpBladeLeveling, "Physical: %4i %s\n", PhysicalCur, - PhysicalFlag ? "++" : ""); - } - - if (BeastCur == 100) - { - fprintf(fpBladeLeveling, "Beast: %4i OK\n", BeastCur); - } - else - { - fprintf(fpBladeLeveling, "Beast: %4i %s\n", BeastCur, - BeastFlag ? "++" : ""); - } - - break; + return; } - case 2: - { - fprintf(fpBladeLeveling, "== BLADE 2 ==\n\n"); - - if (PhantomCur == 100) - { - fprintf(fpBladeLeveling, "Phantom: %4i OK\n", PhantomCur); - } - else - { - fprintf(fpBladeLeveling, "Phantom: %4i %s\n", PhantomCur, - PhantomFlag ? "++" : ""); - } - - if (HumanCur == 100) - { - fprintf(fpBladeLeveling, "Human: %4i OK\n", HumanCur); - } - else - { - fprintf(fpBladeLeveling, "Human: %4i %s\n", HumanCur, - HumanFlag ? "++" : ""); - } - - if (EarthCur == 100) - { - fprintf(fpBladeLeveling, "Earth: %4i OK\n", EarthCur); - } - else - { - fprintf(fpBladeLeveling, "Earth: %4i %s\n", EarthCur, - EarthFlag ? "++" : ""); - } - - if (DarkCur == 100) - { - fprintf(fpBladeLeveling, "Dark: %4i OK\n", DarkCur); - } - else - { - fprintf(fpBladeLeveling, "Dark: %4i %s\n", DarkCur, - DarkFlag ? "++" : ""); - } - - if (WaterCur == 100) - { - fprintf(fpBladeLeveling, "Water: %4i OK\n", WaterCur); - } - else - { - fprintf(fpBladeLeveling, "Water: %4i %s\n", WaterCur, - WaterFlag ? "++" : ""); - } - - break; + FILE *fpWeaponData = fopen("game_data/weapon/weapon.txt", "w"); + + // Check if weapon is eqipped + if (itemBladeCur.ListPosition == 0) { + fwprintf(fpWeaponData, L"Weapon not equipped!\n"); + fclose(fpWeaponData); + + return; } - case 3: - { - fprintf(fpBladeLeveling, "== BLADE 3 ==\n\n"); - - if (FireCur == 100) - { - fprintf(fpBladeLeveling, "Fire: %4i OK\n", FireCur); - } - else - { - fprintf( - fpBladeLeveling, "Fire: %4i %s\n", FireCur, FireFlag ? "++" : ""); - } - - if (AirCur == 100) - { - fprintf(fpBladeLeveling, "Air: %4i OK\n", AirCur); - } - else - { - fprintf(fpBladeLeveling, "Air: %4i %s\n", AirCur, AirFlag ? "++" : ""); - } - - break; + fwprintf(fpWeaponData, L"Weapon Stats\n\n"); + + fwprintf(fpWeaponData, L"Weapon name: %s\n", nameWeaponCur); + fwprintf( + fpWeaponData, L"Blade name: %s\n", WeaponsList[itemBladeCur.ListPosition]); + fwprintf( + fpWeaponData, L"Category: %s\n", WeaponsCategories[itemBladeCur.Category]); + fwprintf( + fpWeaponData, L"Material: %s\n", CraftingMaterials[itemBladeCur.Material]); + fwprintf(fpWeaponData, L"Grip: %s\n", GripsList[itemGripCur.ListPosition]); + fwprintf(fpWeaponData, L"Damage type: %s\n", + WeaponDamageType[itemBladeCur.DamageType]); + fwprintf(fpWeaponData, L"\n"); + + // Bonuses + i16 STRTotal = itemBladeCur.STR + itemGripCur.STR + itemGem1WeaponCur.STR + + itemGem2WeaponCur.STR + itemGem3WeaponCur.STR; + i16 INTTotal = itemBladeCur.INT + itemGripCur.INT + itemGem1WeaponCur.INT + + itemGem2WeaponCur.INT + itemGem3WeaponCur.INT; + i16 AGLTotal = itemBladeCur.AGL + itemGripCur.AGL + itemGem1WeaponCur.AGL + + itemGem2WeaponCur.AGL + itemGem3WeaponCur.AGL; + + fwprintf(fpWeaponData, L"BONUSES\n"); + fwprintf(fpWeaponData, L"========\n"); + fwprintf(fpWeaponData, L"STR: %3i\n", STRTotal); + fwprintf(fpWeaponData, L"INT: %3i\n", INTTotal); + fwprintf(fpWeaponData, L"AGL: %3i\n", AGLTotal); + fwprintf(fpWeaponData, L"\n"); + + // DP & PP + fwprintf(fpWeaponData, L"DURABILITY\n"); + fwprintf(fpWeaponData, L"===========\n"); + fwprintf(fpWeaponData, L"DP: %3i/%3i\n", (itemBladeCur.DPCur + 99) / 100, + (itemBladeCur.DPMax + 99) / 100); + fwprintf( + fpWeaponData, L"PP: %3i/%3i\n", itemBladeCur.PPCur, itemBladeCur.PPMax); + fwprintf(fpWeaponData, L"\n"); + + // Misc + fwprintf(fpWeaponData, L"MISC\n"); + fwprintf(fpWeaponData, L"=======================\n"); + + // Range + fwprintf(fpWeaponData, L"Range (x/y/z): %2i/%2i/%2i\n", itemBladeCur.Range.x, + itemBladeCur.Range.y, itemBladeCur.Range.z); + + // Resource cost + fwprintf(fpWeaponData, L"Attack cost: %i %s\n", itemBladeCur.StatsCostValue, + WeaponAttackCostType[itemBladeCur.StatsCostType]); + + fwprintf(fpWeaponData, L"\n"); + + // Gems + u8 GemSlots = itemGripCur.GemSlots; + if (GemSlots) { + fwprintf(fpWeaponData, L"GEMS\n"); + fwprintf(fpWeaponData, L"=========================\n"); + + fwprintf(fpWeaponData, L"Slot 1: %17s\n", + GemsList[itemGem1WeaponCur.ListPosition]); + + if (GemSlots > 1) { + fwprintf(fpWeaponData, L"Slot 2: %17s\n", + GemsList[itemGem2WeaponCur.ListPosition]); + } + if (GemSlots > 2) { + fwprintf(fpWeaponData, L"Slot 3: %17s\n", + GemsList[itemGem3WeaponCur.ListPosition]); + } } - case 4: + fwprintf(fpWeaponData, L"\n"); + + // Type + fwprintf(fpWeaponData, L"TYPE\n"); + fwprintf(fpWeaponData, L"============\n"); + fwprintf(fpWeaponData, L"Blunt: %2i\n", itemGripCur.TypeBlunt); + fwprintf(fpWeaponData, L"Edged: %2i\n", itemGripCur.TypeEdged); + fwprintf(fpWeaponData, L"Piercing: %2i\n", itemGripCur.TypePiercing); + fwprintf(fpWeaponData, L"\n"); + + // Class summary + i16 ClassHumanTotal = itemBladeCur.ClassHuman + itemGem1WeaponCur.ClassHuman + + itemGem2WeaponCur.ClassHuman + + itemGem3WeaponCur.ClassHuman; + i16 ClassBeastTotal = itemBladeCur.ClassBeast + itemGem1WeaponCur.ClassBeast + + itemGem2WeaponCur.ClassBeast + + itemGem3WeaponCur.ClassBeast; + i16 ClassUndeadTotal = + itemBladeCur.ClassUndead + itemGem1WeaponCur.ClassUndead + + itemGem2WeaponCur.ClassUndead + itemGem3WeaponCur.ClassUndead; + i16 ClassPhantomTotal = + itemBladeCur.ClassPhantom + itemGem1WeaponCur.ClassPhantom + + itemGem2WeaponCur.ClassPhantom + itemGem3WeaponCur.ClassPhantom; + i16 ClassDragonTotal = + itemBladeCur.ClassDragon + itemGem1WeaponCur.ClassDragon + + itemGem2WeaponCur.ClassDragon + itemGem3WeaponCur.ClassDragon; + i16 ClassEvilTotal = itemBladeCur.ClassEvil + itemGem1WeaponCur.ClassEvil + + itemGem2WeaponCur.ClassEvil + + itemGem3WeaponCur.ClassEvil; + + // Affinity summary + i16 AffinityPhysicalTotal = + itemBladeCur.AffinityPhysical + itemGem1WeaponCur.AffinityPhysical + + itemGem2WeaponCur.AffinityPhysical + itemGem3WeaponCur.AffinityPhysical; + i16 AffinityAirTotal = + itemBladeCur.AffinityAir + itemGem1WeaponCur.AffinityAir + + itemGem2WeaponCur.AffinityAir + itemGem3WeaponCur.AffinityAir; + i16 AffinityFireTotal = + itemBladeCur.AffinityFire + itemGem1WeaponCur.AffinityFire + + itemGem2WeaponCur.AffinityFire + itemGem3WeaponCur.AffinityFire; + i16 AffinityEarthTotal = + itemBladeCur.AffinityEarth + itemGem1WeaponCur.AffinityEarth + + itemGem2WeaponCur.AffinityEarth + itemGem3WeaponCur.AffinityEarth; + i16 AffinityWaterTotal = + itemBladeCur.AffinityWater + itemGem1WeaponCur.AffinityWater + + itemGem2WeaponCur.AffinityWater + itemGem3WeaponCur.AffinityWater; + i16 AffinityLightTotal = + itemBladeCur.AffinityLight + itemGem1WeaponCur.AffinityLight + + itemGem2WeaponCur.AffinityLight + itemGem3WeaponCur.AffinityLight; + i16 AffinityDarkTotal = + itemBladeCur.AffinityDark + itemGem1WeaponCur.AffinityDark + + itemGem2WeaponCur.AffinityDark + itemGem3WeaponCur.AffinityDark; + + // Class + fwprintf(fpWeaponData, L"CLASS\n"); + fwprintf(fpWeaponData, L"=============\n"); + fwprintf(fpWeaponData, L"Human: %3i\n", ClassHumanTotal); + fwprintf(fpWeaponData, L"Beast: %3i\n", ClassBeastTotal); + fwprintf(fpWeaponData, L"Undead: %3i\n", ClassUndeadTotal); + fwprintf(fpWeaponData, L"Phantom: %3i\n", ClassPhantomTotal); + fwprintf(fpWeaponData, L"Dragon: %3i\n", ClassDragonTotal); + fwprintf(fpWeaponData, L"Evil: %3i\n", ClassEvilTotal); + fwprintf(fpWeaponData, L"\n"); + + // Affinity + fwprintf(fpWeaponData, L"AFFINITY\n"); + fwprintf(fpWeaponData, L"=============\n"); + fwprintf(fpWeaponData, L"Physical: %3i\n", AffinityPhysicalTotal); + fwprintf(fpWeaponData, L"Air: %3i\n", AffinityAirTotal); + fwprintf(fpWeaponData, L"Fire: %3i\n", AffinityFireTotal); + fwprintf(fpWeaponData, L"Earth: %3i\n", AffinityEarthTotal); + fwprintf(fpWeaponData, L"Water: %3i\n", AffinityWaterTotal); + fwprintf(fpWeaponData, L"Light: %3i\n", AffinityLightTotal); + fwprintf(fpWeaponData, L"Dark: %3i\n", AffinityDarkTotal); + + fclose(fpWeaponData); +} + +void +WriteShieldData() { + // Check for out-of-bound indexes + if (itemShieldCur.ListPosition > _countof(ArmorsList) - 1 || // + itemShieldCur.Material > _countof(CraftingMaterials) - 1 || // + itemGem1ShieldCur.ListPosition > _countof(GemsList) - 1 || // + itemGem2ShieldCur.ListPosition > _countof(GemsList) - 1 || // + itemGem3ShieldCur.ListPosition > _countof(GemsList) - 1) { - fprintf(fpBladeLeveling, "== BLADE 4 ==\n\n"); - - if (UndeadCur == 100) - { - fprintf(fpBladeLeveling, "Undead: %4i OK\n", UndeadCur); - } - else - { - fprintf(fpBladeLeveling, "Undead: %4i %s\n", UndeadCur, - UndeadFlag ? "++" : ""); - } - - if (EvilCur == 100) - { - fprintf(fpBladeLeveling, "Evil: %4i OK\n", EvilCur); - } - else - { - fprintf( - fpBladeLeveling, "Evil: %4i %s\n", EvilCur, EvilFlag ? "++" : ""); - } - - if (LightCur == 100) - { - fprintf(fpBladeLeveling, "Light: %4i OK\n", LightCur); - } - else - { - fprintf(fpBladeLeveling, "Light: %4i %s\n", LightCur, - LightFlag ? "++" : ""); - } - break; + return; } - default: - { - fprintf(fpBladeLeveling, "No leveling weapon equipped\n"); + FILE *fpShieldData = fopen("game_data/armor/shield.txt", "w"); + + // Check if shield is eqipped. If not, write the warning and skip the rest. + if (itemShieldCur.ListPosition == 0) { + fwprintf(fpShieldData, L"Shield not equipped!\n"); + fclose(fpShieldData); + + return; } - } - fclose(fpBladeLeveling); -} -void -WriteBladeData() -{ - // Check for out-of-bound indexes - if (itemBladeCur.NamesListPosition > _countof(ItemNamesList) - 1 || // - itemBladeCur.ListPosition > _countof(WeaponsList) - 1 || // - itemBladeCur.Category > _countof(WeaponsCategories) - 1) - { - return; - } - - FILE *fpBladeData = fopen("game_data/weapon/blade.txt", "w"); - - // Check if weapon is eqipped - if (itemBladeCur.ListPosition == 0) - { - fprintf( - fpBladeData, "Can't read the blade data: weapon is not equipped!\n"); - fclose(fpBladeData); + fwprintf(fpShieldData, L"Shield Stats\n\n"); + + fwprintf(fpShieldData, L"Name: %s\n", ArmorsList[itemShieldCur.ListPosition]); + fwprintf(fpShieldData, L"Material: %s\n", + CraftingMaterials[itemShieldCur.Material]); + + fwprintf(fpShieldData, L"\n"); + + // Bonuses + i16 STRTotal = itemShieldCur.STR + itemGem1ShieldCur.STR + + itemGem2ShieldCur.STR + itemGem3ShieldCur.STR; + i16 INTTotal = itemShieldCur.INT + itemGem1ShieldCur.INT + + itemGem2ShieldCur.INT + itemGem3ShieldCur.INT; + i16 AGLTotal = itemShieldCur.AGL + itemGem1ShieldCur.AGL + + itemGem2ShieldCur.AGL + itemGem3ShieldCur.AGL; + + fwprintf(fpShieldData, L"BONUSES\n"); + fwprintf(fpShieldData, L"========\n"); + fwprintf(fpShieldData, L"STR: %3i\n", STRTotal); + fwprintf(fpShieldData, L"INT: %3i\n", INTTotal); + fwprintf(fpShieldData, L"AGL: %3i\n", AGLTotal); + fwprintf(fpShieldData, L"\n"); + + // DP & PP + fwprintf(fpShieldData, L"DURABILITY\n"); + fwprintf(fpShieldData, L"===========\n"); + fwprintf(fpShieldData, L"DP: %3i/%3i\n", (itemShieldCur.DPCur + 99) / 100, + (itemShieldCur.DPMax + 99) / 100); + fwprintf( + fpShieldData, L"PP: %3i/%3i\n", itemShieldCur.PPCur, itemShieldCur.PPMax); + fwprintf(fpShieldData, L"\n"); + + // Gems + + // Gems + u8 GemSlots = itemShieldCur.GemSlots; + if (GemSlots) { + fwprintf(fpShieldData, L"GEMS\n"); + fwprintf(fpShieldData, L"=========================\n"); + + fwprintf(fpShieldData, L"Slot 1: %17s\n", + GemsList[itemGem1ShieldCur.ListPosition]); + + if (GemSlots > 1) { + fwprintf(fpShieldData, L"Slot 2: %17s\n", + GemsList[itemGem2ShieldCur.ListPosition]); + } + if (GemSlots > 2) { + fwprintf(fpShieldData, L"Slot 3: %17s\n", + GemsList[itemGem3ShieldCur.ListPosition]); + } + } + fwprintf(fpShieldData, L"\n"); + + // Type + fwprintf(fpShieldData, L"TYPE\n"); + fwprintf(fpShieldData, L"============\n"); + fwprintf(fpShieldData, L"Blunt: %2i\n", itemShieldCur.TypeBlunt); + fwprintf(fpShieldData, L"Edged: %2i\n", itemShieldCur.TypeEdged); + fwprintf(fpShieldData, L"Piercing: %2i\n", itemShieldCur.TypePiercing); + fwprintf(fpShieldData, L"\n"); + + // Class summary + i16 ClassHumanTotal = + itemShieldCur.ClassHuman + itemGem1ShieldCur.ClassHuman + + itemGem2ShieldCur.ClassHuman + itemGem3ShieldCur.ClassHuman; + i16 ClassBeastTotal = + itemShieldCur.ClassBeast + itemGem1ShieldCur.ClassBeast + + itemGem2ShieldCur.ClassBeast + itemGem3ShieldCur.ClassBeast; + i16 ClassUndeadTotal = + itemShieldCur.ClassUndead + itemGem1ShieldCur.ClassUndead + + itemGem2ShieldCur.ClassUndead + itemGem3ShieldCur.ClassUndead; + i16 ClassPhantomTotal = + itemShieldCur.ClassPhantom + itemGem1ShieldCur.ClassPhantom + + itemGem2ShieldCur.ClassPhantom + itemGem3ShieldCur.ClassPhantom; + i16 ClassDragonTotal = + itemShieldCur.ClassDragon + itemGem1ShieldCur.ClassDragon + + itemGem2ShieldCur.ClassDragon + itemGem3ShieldCur.ClassDragon; + i16 ClassEvilTotal = itemShieldCur.ClassEvil + itemGem1ShieldCur.ClassEvil + + itemGem2ShieldCur.ClassEvil + + itemGem3ShieldCur.ClassEvil; + + // Affinity summary + i16 AffinityPhysicalTotal = + itemShieldCur.AffinityPhysical + itemGem1ShieldCur.AffinityPhysical + + itemGem2ShieldCur.AffinityPhysical + itemGem3ShieldCur.AffinityPhysical; + i16 AffinityAirTotal = + itemShieldCur.AffinityAir + itemGem1ShieldCur.AffinityAir + + itemGem2ShieldCur.AffinityAir + itemGem3ShieldCur.AffinityAir; + i16 AffinityFireTotal = + itemShieldCur.AffinityFire + itemGem1ShieldCur.AffinityFire + + itemGem2ShieldCur.AffinityFire + itemGem3ShieldCur.AffinityFire; + i16 AffinityEarthTotal = + itemShieldCur.AffinityEarth + itemGem1ShieldCur.AffinityEarth + + itemGem2ShieldCur.AffinityEarth + itemGem3ShieldCur.AffinityEarth; + i16 AffinityWaterTotal = + itemShieldCur.AffinityWater + itemGem1ShieldCur.AffinityWater + + itemGem2ShieldCur.AffinityWater + itemGem3ShieldCur.AffinityWater; + i16 AffinityLightTotal = + itemShieldCur.AffinityLight + itemGem1ShieldCur.AffinityLight + + itemGem2ShieldCur.AffinityLight + itemGem3ShieldCur.AffinityLight; + i16 AffinityDarkTotal = + itemShieldCur.AffinityDark + itemGem1ShieldCur.AffinityDark + + itemGem2ShieldCur.AffinityDark + itemGem3ShieldCur.AffinityDark; + + // Class + fwprintf(fpShieldData, L"CLASS\n"); + fwprintf(fpShieldData, L"=============\n"); + fwprintf(fpShieldData, L"Human: %3i\n", ClassHumanTotal); + fwprintf(fpShieldData, L"Beast: %3i\n", ClassBeastTotal); + fwprintf(fpShieldData, L"Undead: %3i\n", ClassUndeadTotal); + fwprintf(fpShieldData, L"Phantom: %3i\n", ClassPhantomTotal); + fwprintf(fpShieldData, L"Dragon: %3i\n", ClassDragonTotal); + fwprintf(fpShieldData, L"Evil: %3i\n", ClassEvilTotal); + fwprintf(fpShieldData, L"\n"); + + // Affinity + fwprintf(fpShieldData, L"AFFINITY\n"); + fwprintf(fpShieldData, L"=============\n"); + fwprintf(fpShieldData, L"Physical: %3i\n", AffinityPhysicalTotal); + fwprintf(fpShieldData, L"Air: %3i\n", AffinityAirTotal); + fwprintf(fpShieldData, L"Fire: %3i\n", AffinityFireTotal); + fwprintf(fpShieldData, L"Earth: %3i\n", AffinityEarthTotal); + fwprintf(fpShieldData, L"Water: %3i\n", AffinityWaterTotal); + fwprintf(fpShieldData, L"Light: %3i\n", AffinityLightTotal); + fwprintf(fpShieldData, L"Dark: %3i\n", AffinityDarkTotal); - return; - } - - fprintf(fpBladeData, "Blade Stats\n\n"); - - fprintf(fpBladeData, "Name: %s\n", WeaponsList[itemBladeCur.ListPosition]); - fprintf( - fpBladeData, "Category: %s\n", WeaponsCategories[itemBladeCur.Category]); - fprintf( - fpBladeData, "Material: %s\n", CraftingMaterials[itemBladeCur.Material]); - fprintf(fpBladeData, "Damage type: %s\n", - WeaponDamageType[itemBladeCur.DamageType]); - fprintf(fpBladeData, "\n"); - - // Bonuses - fprintf(fpBladeData, "BONUSES\n"); - fprintf(fpBladeData, "========\n"); - fprintf(fpBladeData, "STR: %3i\n", itemBladeCur.STR); - fprintf(fpBladeData, "INT: %3i\n", itemBladeCur.INT); - fprintf(fpBladeData, "AGL: %3i\n", itemBladeCur.AGL); - fprintf(fpBladeData, "\n"); - - // DP & PP - fprintf(fpBladeData, "DURABILITY\n"); - fprintf(fpBladeData, "===========\n"); - fprintf(fpBladeData, "DP: %3i/%3i\n", (itemBladeCur.DPCur + 99) / 100, - (itemBladeCur.DPMax + 99) / 100); - fprintf(fpBladeData, "PP: %3i/%3i\n", itemBladeCur.PPCur, itemBladeCur.PPMax); - fprintf(fpBladeData, "\n"); - - // Misc - fprintf(fpBladeData, "MISC\n"); - fprintf(fpBladeData, "=======================\n"); - - // Range - fprintf(fpBladeData, "Range (x/y/z): %2i/%2i/%2i\n", itemBladeCur.Range.x, - itemBladeCur.Range.y, itemBladeCur.Range.z); - - // Resource cost - fprintf(fpBladeData, "Attack cost: %i %s\n", itemBladeCur.StatsCostValue, - WeaponAttackCostType[itemBladeCur.StatsCostType]); - fprintf(fpBladeData, "\n"); - - // Class - fprintf(fpBladeData, "CLASS\n"); - fprintf(fpBladeData, "=============\n"); - fprintf(fpBladeData, "Human: %3i\n", itemBladeCur.ClassHuman); - fprintf(fpBladeData, "Beast: %3i\n", itemBladeCur.ClassBeast); - fprintf(fpBladeData, "Undead: %3i\n", itemBladeCur.ClassUndead); - fprintf(fpBladeData, "Phantom: %3i\n", itemBladeCur.ClassPhantom); - fprintf(fpBladeData, "Dragon: %3i\n", itemBladeCur.ClassDragon); - fprintf(fpBladeData, "Evil: %3i\n", itemBladeCur.ClassEvil); - fprintf(fpBladeData, "\n"); - - // Affinity - fprintf(fpBladeData, "AFFINITY\n"); - fprintf(fpBladeData, "=============\n"); - fprintf(fpBladeData, "Physical: %3i\n", itemBladeCur.AffinityPhysical); - fprintf(fpBladeData, "Air: %3i\n", itemBladeCur.AffinityAir); - fprintf(fpBladeData, "Fire: %3i\n", itemBladeCur.AffinityFire); - fprintf(fpBladeData, "Earth: %3i\n", itemBladeCur.AffinityEarth); - fprintf(fpBladeData, "Water: %3i\n", itemBladeCur.AffinityWater); - fprintf(fpBladeData, "Light: %3i\n", itemBladeCur.AffinityLight); - fprintf(fpBladeData, "Dark: %3i\n", itemBladeCur.AffinityDark); - - fclose(fpBladeData); + fclose(fpShieldData); } void -WriteWeaponData() -{ - // Check for out-of-bound indexes - if (itemBladeCur.NamesListPosition > _countof(ItemNamesList) - 1 || // - itemBladeCur.ListPosition > _countof(WeaponsList) - 1 || // - itemBladeCur.Category > _countof(WeaponsCategories) - 1 || // - itemBladeCur.Material > _countof(CraftingMaterials) - 1 || // - itemGripCur.ListPosition > _countof(GripsList) - 1 || // - itemGem1WeaponCur.ListPosition > _countof(GemsList) - 1 || // - itemGem2WeaponCur.ListPosition > _countof(GemsList) - 1 || // - itemGem3WeaponCur.ListPosition > _countof(GemsList) - 1) - { - return; - } - - FILE *fpWeaponData = fopen("game_data/weapon/weapon.txt", "w"); - - // Check if weapon is eqipped - if (itemBladeCur.ListPosition == 0) - { - fprintf(fpWeaponData, "Weapon not equipped!\n"); - fclose(fpWeaponData); - - return; - } - - fprintf(fpWeaponData, "Weapon Stats\n\n"); - - fprintf(fpWeaponData, "Weapon name: %s\n", nameWeaponCur); - fprintf( - fpWeaponData, "Blade name: %s\n", WeaponsList[itemBladeCur.ListPosition]); - fprintf( - fpWeaponData, "Category: %s\n", WeaponsCategories[itemBladeCur.Category]); - fprintf( - fpWeaponData, "Material: %s\n", CraftingMaterials[itemBladeCur.Material]); - fprintf(fpWeaponData, "Grip: %s\n", GripsList[itemGripCur.ListPosition]); - fprintf(fpWeaponData, "Damage type: %s\n", - WeaponDamageType[itemBladeCur.DamageType]); - fprintf(fpWeaponData, "\n"); - - // Bonuses - i16 STRTotal = itemBladeCur.STR + itemGripCur.STR + itemGem1WeaponCur.STR + - itemGem2WeaponCur.STR + itemGem3WeaponCur.STR; - i16 INTTotal = itemBladeCur.INT + itemGripCur.INT + itemGem1WeaponCur.INT + - itemGem2WeaponCur.INT + itemGem3WeaponCur.INT; - i16 AGLTotal = itemBladeCur.AGL + itemGripCur.AGL + itemGem1WeaponCur.AGL + - itemGem2WeaponCur.AGL + itemGem3WeaponCur.AGL; - - fprintf(fpWeaponData, "BONUSES\n"); - fprintf(fpWeaponData, "========\n"); - fprintf(fpWeaponData, "STR: %3i\n", STRTotal); - fprintf(fpWeaponData, "INT: %3i\n", INTTotal); - fprintf(fpWeaponData, "AGL: %3i\n", AGLTotal); - fprintf(fpWeaponData, "\n"); - - // DP & PP - fprintf(fpWeaponData, "DURABILITY\n"); - fprintf(fpWeaponData, "===========\n"); - fprintf(fpWeaponData, "DP: %3i/%3i\n", (itemBladeCur.DPCur + 99) / 100, - (itemBladeCur.DPMax + 99) / 100); - fprintf( - fpWeaponData, "PP: %3i/%3i\n", itemBladeCur.PPCur, itemBladeCur.PPMax); - fprintf(fpWeaponData, "\n"); - - // Misc - fprintf(fpWeaponData, "MISC\n"); - fprintf(fpWeaponData, "=======================\n"); - - // Range - fprintf(fpWeaponData, "Range (x/y/z): %2i/%2i/%2i\n", itemBladeCur.Range.x, - itemBladeCur.Range.y, itemBladeCur.Range.z); - - // Resource cost - fprintf(fpWeaponData, "Attack cost: %i %s\n", itemBladeCur.StatsCostValue, - WeaponAttackCostType[itemBladeCur.StatsCostType]); - - fprintf(fpWeaponData, "\n"); - - // Gems - u8 GemSlots = itemGripCur.GemSlots; - if (GemSlots) - { - fprintf(fpWeaponData, "GEMS\n"); - fprintf(fpWeaponData, "=========================\n"); - - fprintf(fpWeaponData, "Slot 1: %17s\n", - GemsList[itemGem1WeaponCur.ListPosition]); - - if (GemSlots > 1) +WriteGloveLeftData() { + // Check for out-of-bound indexes + if (itemGloveLeftCur.ListPosition > _countof(ArmorsList) - 1 || // + itemGloveLeftCur.Material > _countof(CraftingMaterials) - 1) { - fprintf(fpWeaponData, "Slot 2: %17s\n", - GemsList[itemGem2WeaponCur.ListPosition]); + return; } - if (GemSlots > 2) - { - fprintf(fpWeaponData, "Slot 3: %17s\n", - GemsList[itemGem3WeaponCur.ListPosition]); + + FILE *fpGloveLeftData = fopen("game_data/armor/glove_left.txt", "w"); + + // Check if a glove is eqipped. If not, write the warning and skip the rest. + if (itemGloveLeftCur.ListPosition == 0) { + fwprintf(fpGloveLeftData, L"No left glove equipped!\n"); + + fclose(fpGloveLeftData); + + return; } - } - - fprintf(fpWeaponData, "\n"); - - // Type - fprintf(fpWeaponData, "TYPE\n"); - fprintf(fpWeaponData, "============\n"); - fprintf(fpWeaponData, "Blunt: %2i\n", itemGripCur.TypeBlunt); - fprintf(fpWeaponData, "Edged: %2i\n", itemGripCur.TypeEdged); - fprintf(fpWeaponData, "Piercing: %2i\n", itemGripCur.TypePiercing); - fprintf(fpWeaponData, "\n"); - - // Class summary - i16 ClassHumanTotal = itemBladeCur.ClassHuman + itemGem1WeaponCur.ClassHuman + - itemGem2WeaponCur.ClassHuman + - itemGem3WeaponCur.ClassHuman; - i16 ClassBeastTotal = itemBladeCur.ClassBeast + itemGem1WeaponCur.ClassBeast + - itemGem2WeaponCur.ClassBeast + - itemGem3WeaponCur.ClassBeast; - i16 ClassUndeadTotal = - itemBladeCur.ClassUndead + itemGem1WeaponCur.ClassUndead + - itemGem2WeaponCur.ClassUndead + itemGem3WeaponCur.ClassUndead; - i16 ClassPhantomTotal = - itemBladeCur.ClassPhantom + itemGem1WeaponCur.ClassPhantom + - itemGem2WeaponCur.ClassPhantom + itemGem3WeaponCur.ClassPhantom; - i16 ClassDragonTotal = - itemBladeCur.ClassDragon + itemGem1WeaponCur.ClassDragon + - itemGem2WeaponCur.ClassDragon + itemGem3WeaponCur.ClassDragon; - i16 ClassEvilTotal = itemBladeCur.ClassEvil + itemGem1WeaponCur.ClassEvil + - itemGem2WeaponCur.ClassEvil + - itemGem3WeaponCur.ClassEvil; - - // Affinity summary - i16 AffinityPhysicalTotal = - itemBladeCur.AffinityPhysical + itemGem1WeaponCur.AffinityPhysical + - itemGem2WeaponCur.AffinityPhysical + itemGem3WeaponCur.AffinityPhysical; - i16 AffinityAirTotal = - itemBladeCur.AffinityAir + itemGem1WeaponCur.AffinityAir + - itemGem2WeaponCur.AffinityAir + itemGem3WeaponCur.AffinityAir; - i16 AffinityFireTotal = - itemBladeCur.AffinityFire + itemGem1WeaponCur.AffinityFire + - itemGem2WeaponCur.AffinityFire + itemGem3WeaponCur.AffinityFire; - i16 AffinityEarthTotal = - itemBladeCur.AffinityEarth + itemGem1WeaponCur.AffinityEarth + - itemGem2WeaponCur.AffinityEarth + itemGem3WeaponCur.AffinityEarth; - i16 AffinityWaterTotal = - itemBladeCur.AffinityWater + itemGem1WeaponCur.AffinityWater + - itemGem2WeaponCur.AffinityWater + itemGem3WeaponCur.AffinityWater; - i16 AffinityLightTotal = - itemBladeCur.AffinityLight + itemGem1WeaponCur.AffinityLight + - itemGem2WeaponCur.AffinityLight + itemGem3WeaponCur.AffinityLight; - i16 AffinityDarkTotal = - itemBladeCur.AffinityDark + itemGem1WeaponCur.AffinityDark + - itemGem2WeaponCur.AffinityDark + itemGem3WeaponCur.AffinityDark; - - // Class - fprintf(fpWeaponData, "CLASS\n"); - fprintf(fpWeaponData, "=============\n"); - fprintf(fpWeaponData, "Human: %3i\n", ClassHumanTotal); - fprintf(fpWeaponData, "Beast: %3i\n", ClassBeastTotal); - fprintf(fpWeaponData, "Undead: %3i\n", ClassUndeadTotal); - fprintf(fpWeaponData, "Phantom: %3i\n", ClassPhantomTotal); - fprintf(fpWeaponData, "Dragon: %3i\n", ClassDragonTotal); - fprintf(fpWeaponData, "Evil: %3i\n", ClassEvilTotal); - fprintf(fpWeaponData, "\n"); - - // Affinity - fprintf(fpWeaponData, "AFFINITY\n"); - fprintf(fpWeaponData, "=============\n"); - fprintf(fpWeaponData, "Physical: %3i\n", AffinityPhysicalTotal); - fprintf(fpWeaponData, "Air: %3i\n", AffinityAirTotal); - fprintf(fpWeaponData, "Fire: %3i\n", AffinityFireTotal); - fprintf(fpWeaponData, "Earth: %3i\n", AffinityEarthTotal); - fprintf(fpWeaponData, "Water: %3i\n", AffinityWaterTotal); - fprintf(fpWeaponData, "Light: %3i\n", AffinityLightTotal); - fprintf(fpWeaponData, "Dark: %3i\n", AffinityDarkTotal); - - fclose(fpWeaponData); + + fwprintf(fpGloveLeftData, L"Left Glove Stats\n\n"); + + fwprintf( + fpGloveLeftData, L"Name: %s\n", ArmorsList[itemGloveLeftCur.ListPosition]); + fwprintf(fpGloveLeftData, L"Material: %s\n", + CraftingMaterials[itemGloveLeftCur.Material]); + fwprintf(fpGloveLeftData, L"\n"); + + // Bonuses + fwprintf(fpGloveLeftData, L"BONUSES\n"); + fwprintf(fpGloveLeftData, L"========\n"); + fwprintf(fpGloveLeftData, L"STR: %3i\n", itemGloveLeftCur.STR); + fwprintf(fpGloveLeftData, L"INT: %3i\n", itemGloveLeftCur.INT); + fwprintf(fpGloveLeftData, L"AGL: %3i\n", itemGloveLeftCur.AGL); + fwprintf(fpGloveLeftData, L"\n"); + + // DP + fwprintf(fpGloveLeftData, L"DURABILITY\n"); + fwprintf(fpGloveLeftData, L"===========\n"); + fwprintf(fpGloveLeftData, L"DP: %3i/%3i\n", (itemGloveLeftCur.DPCur + 99) / 100, + (itemGloveLeftCur.DPMax + 99) / 100); + fwprintf(fpGloveLeftData, L"\n"); + + // Type + fwprintf(fpGloveLeftData, L"TYPE\n"); + fwprintf(fpGloveLeftData, L"============\n"); + fwprintf(fpGloveLeftData, L"Blunt: %2i\n", itemGloveLeftCur.TypeBlunt); + fwprintf(fpGloveLeftData, L"Edged: %2i\n", itemGloveLeftCur.TypeEdged); + fwprintf(fpGloveLeftData, L"Piercing: %2i\n", itemGloveLeftCur.TypePiercing); + fwprintf(fpGloveLeftData, L"\n"); + + // Class + fwprintf(fpGloveLeftData, L"CLASS\n"); + fwprintf(fpGloveLeftData, L"=============\n"); + fwprintf(fpGloveLeftData, L"Human: %3i\n", itemGloveLeftCur.ClassHuman); + fwprintf(fpGloveLeftData, L"Beast: %3i\n", itemGloveLeftCur.ClassBeast); + fwprintf(fpGloveLeftData, L"Undead: %3i\n", itemGloveLeftCur.ClassUndead); + fwprintf(fpGloveLeftData, L"Phantom: %3i\n", itemGloveLeftCur.ClassPhantom); + fwprintf(fpGloveLeftData, L"Dragon: %3i\n", itemGloveLeftCur.ClassDragon); + fwprintf(fpGloveLeftData, L"Evil: %3i\n", itemGloveLeftCur.ClassEvil); + fwprintf(fpGloveLeftData, L"\n"); + + // Affinity + fwprintf(fpGloveLeftData, L"AFFINITY\n"); + fwprintf(fpGloveLeftData, L"=============\n"); + fwprintf( + fpGloveLeftData, L"Physical: %3i\n", itemGloveLeftCur.AffinityPhysical); + fwprintf(fpGloveLeftData, L"Air: %3i\n", itemGloveLeftCur.AffinityAir); + fwprintf(fpGloveLeftData, L"Fire: %3i\n", itemGloveLeftCur.AffinityFire); + fwprintf(fpGloveLeftData, L"Earth: %3i\n", itemGloveLeftCur.AffinityEarth); + fwprintf(fpGloveLeftData, L"Water: %3i\n", itemGloveLeftCur.AffinityWater); + fwprintf(fpGloveLeftData, L"Light: %3i\n", itemGloveLeftCur.AffinityLight); + fwprintf(fpGloveLeftData, L"Dark: %3i\n", itemGloveLeftCur.AffinityDark); + + fclose(fpGloveLeftData); } void -WriteShieldData() -{ - // Check for out-of-bound indexes - if (itemShieldCur.ListPosition > _countof(ArmorsList) - 1 || // - itemShieldCur.Material > _countof(CraftingMaterials) - 1 || // - itemGem1ShieldCur.ListPosition > _countof(GemsList) - 1 || // - itemGem2ShieldCur.ListPosition > _countof(GemsList) - 1 || // - itemGem3ShieldCur.ListPosition > _countof(GemsList) - 1) - { - return; - } - - FILE *fpShieldData = fopen("game_data/armor/shield.txt", "w"); - - // Check if shield is eqipped. If not, write the warning and skip the rest. - if (itemShieldCur.ListPosition == 0) - { - fprintf(fpShieldData, "Shield not equipped!\n"); - fclose(fpShieldData); - - return; - } - - fprintf(fpShieldData, "Shield Stats\n\n"); - - fprintf(fpShieldData, "Name: %s\n", ArmorsList[itemShieldCur.ListPosition]); - fprintf(fpShieldData, "Material: %s\n", - CraftingMaterials[itemShieldCur.Material]); - - fprintf(fpShieldData, "\n"); - - // Bonuses - i16 STRTotal = itemShieldCur.STR + itemGem1ShieldCur.STR + - itemGem2ShieldCur.STR + itemGem3ShieldCur.STR; - i16 INTTotal = itemShieldCur.INT + itemGem1ShieldCur.INT + - itemGem2ShieldCur.INT + itemGem3ShieldCur.INT; - i16 AGLTotal = itemShieldCur.AGL + itemGem1ShieldCur.AGL + - itemGem2ShieldCur.AGL + itemGem3ShieldCur.AGL; - - fprintf(fpShieldData, "BONUSES\n"); - fprintf(fpShieldData, "========\n"); - fprintf(fpShieldData, "STR: %3i\n", STRTotal); - fprintf(fpShieldData, "INT: %3i\n", INTTotal); - fprintf(fpShieldData, "AGL: %3i\n", AGLTotal); - fprintf(fpShieldData, "\n"); - - // DP & PP - fprintf(fpShieldData, "DURABILITY\n"); - fprintf(fpShieldData, "===========\n"); - fprintf(fpShieldData, "DP: %3i/%3i\n", (itemShieldCur.DPCur + 99) / 100, - (itemShieldCur.DPMax + 99) / 100); - fprintf( - fpShieldData, "PP: %3i/%3i\n", itemShieldCur.PPCur, itemShieldCur.PPMax); - fprintf(fpShieldData, "\n"); - - // Gems - - // Gems - u8 GemSlots = itemShieldCur.GemSlots; - if (GemSlots) - { - fprintf(fpShieldData, "GEMS\n"); - fprintf(fpShieldData, "=========================\n"); - - fprintf(fpShieldData, "Slot 1: %17s\n", - GemsList[itemGem1ShieldCur.ListPosition]); - - if (GemSlots > 1) +WriteGloveRightData() { + // Check for out-of-bound indexes + if (itemGloveRightCur.ListPosition > _countof(ArmorsList) - 1 || // + itemGloveRightCur.Material > _countof(CraftingMaterials) - 1) { - fprintf(fpShieldData, "Slot 2: %17s\n", - GemsList[itemGem2ShieldCur.ListPosition]); + return; } - if (GemSlots > 2) - { - fprintf(fpShieldData, "Slot 3: %17s\n", - GemsList[itemGem3ShieldCur.ListPosition]); + + FILE *fpGloveRightData = fopen("game_data/armor/glove_right.txt", "w"); + + // Check if a glove is eqipped. If not, write the warning and skip the rest. + if (itemGloveRightCur.ListPosition == 0) { + fwprintf(fpGloveRightData, L"No left glove equipped!\n"); + + fclose(fpGloveRightData); + + return; } - } - fprintf(fpShieldData, "\n"); - - // Type - fprintf(fpShieldData, "TYPE\n"); - fprintf(fpShieldData, "============\n"); - fprintf(fpShieldData, "Blunt: %2i\n", itemShieldCur.TypeBlunt); - fprintf(fpShieldData, "Edged: %2i\n", itemShieldCur.TypeEdged); - fprintf(fpShieldData, "Piercing: %2i\n", itemShieldCur.TypePiercing); - fprintf(fpShieldData, "\n"); - - // Class summary - i16 ClassHumanTotal = - itemShieldCur.ClassHuman + itemGem1ShieldCur.ClassHuman + - itemGem2ShieldCur.ClassHuman + itemGem3ShieldCur.ClassHuman; - i16 ClassBeastTotal = - itemShieldCur.ClassBeast + itemGem1ShieldCur.ClassBeast + - itemGem2ShieldCur.ClassBeast + itemGem3ShieldCur.ClassBeast; - i16 ClassUndeadTotal = - itemShieldCur.ClassUndead + itemGem1ShieldCur.ClassUndead + - itemGem2ShieldCur.ClassUndead + itemGem3ShieldCur.ClassUndead; - i16 ClassPhantomTotal = - itemShieldCur.ClassPhantom + itemGem1ShieldCur.ClassPhantom + - itemGem2ShieldCur.ClassPhantom + itemGem3ShieldCur.ClassPhantom; - i16 ClassDragonTotal = - itemShieldCur.ClassDragon + itemGem1ShieldCur.ClassDragon + - itemGem2ShieldCur.ClassDragon + itemGem3ShieldCur.ClassDragon; - i16 ClassEvilTotal = itemShieldCur.ClassEvil + itemGem1ShieldCur.ClassEvil + - itemGem2ShieldCur.ClassEvil + - itemGem3ShieldCur.ClassEvil; - - // Affinity summary - i16 AffinityPhysicalTotal = - itemShieldCur.AffinityPhysical + itemGem1ShieldCur.AffinityPhysical + - itemGem2ShieldCur.AffinityPhysical + itemGem3ShieldCur.AffinityPhysical; - i16 AffinityAirTotal = - itemShieldCur.AffinityAir + itemGem1ShieldCur.AffinityAir + - itemGem2ShieldCur.AffinityAir + itemGem3ShieldCur.AffinityAir; - i16 AffinityFireTotal = - itemShieldCur.AffinityFire + itemGem1ShieldCur.AffinityFire + - itemGem2ShieldCur.AffinityFire + itemGem3ShieldCur.AffinityFire; - i16 AffinityEarthTotal = - itemShieldCur.AffinityEarth + itemGem1ShieldCur.AffinityEarth + - itemGem2ShieldCur.AffinityEarth + itemGem3ShieldCur.AffinityEarth; - i16 AffinityWaterTotal = - itemShieldCur.AffinityWater + itemGem1ShieldCur.AffinityWater + - itemGem2ShieldCur.AffinityWater + itemGem3ShieldCur.AffinityWater; - i16 AffinityLightTotal = - itemShieldCur.AffinityLight + itemGem1ShieldCur.AffinityLight + - itemGem2ShieldCur.AffinityLight + itemGem3ShieldCur.AffinityLight; - i16 AffinityDarkTotal = - itemShieldCur.AffinityDark + itemGem1ShieldCur.AffinityDark + - itemGem2ShieldCur.AffinityDark + itemGem3ShieldCur.AffinityDark; - - // Class - fprintf(fpShieldData, "CLASS\n"); - fprintf(fpShieldData, "=============\n"); - fprintf(fpShieldData, "Human: %3i\n", ClassHumanTotal); - fprintf(fpShieldData, "Beast: %3i\n", ClassBeastTotal); - fprintf(fpShieldData, "Undead: %3i\n", ClassUndeadTotal); - fprintf(fpShieldData, "Phantom: %3i\n", ClassPhantomTotal); - fprintf(fpShieldData, "Dragon: %3i\n", ClassDragonTotal); - fprintf(fpShieldData, "Evil: %3i\n", ClassEvilTotal); - fprintf(fpShieldData, "\n"); - - // Affinity - fprintf(fpShieldData, "AFFINITY\n"); - fprintf(fpShieldData, "=============\n"); - fprintf(fpShieldData, "Physical: %3i\n", AffinityPhysicalTotal); - fprintf(fpShieldData, "Air: %3i\n", AffinityAirTotal); - fprintf(fpShieldData, "Fire: %3i\n", AffinityFireTotal); - fprintf(fpShieldData, "Earth: %3i\n", AffinityEarthTotal); - fprintf(fpShieldData, "Water: %3i\n", AffinityWaterTotal); - fprintf(fpShieldData, "Light: %3i\n", AffinityLightTotal); - fprintf(fpShieldData, "Dark: %3i\n", AffinityDarkTotal); - - fclose(fpShieldData); + + fwprintf(fpGloveRightData, L"Right Glove Stats\n\n"); + + fwprintf(fpGloveRightData, L"Name: %s\n", + ArmorsList[itemGloveRightCur.ListPosition]); + fwprintf(fpGloveRightData, L"Material: %s\n", + CraftingMaterials[itemGloveRightCur.Material]); + fwprintf(fpGloveRightData, L"\n"); + + // Bonuses + fwprintf(fpGloveRightData, L"BONUSES\n"); + fwprintf(fpGloveRightData, L"========\n"); + fwprintf(fpGloveRightData, L"STR: %3i\n", itemGloveRightCur.STR); + fwprintf(fpGloveRightData, L"INT: %3i\n", itemGloveRightCur.INT); + fwprintf(fpGloveRightData, L"AGL: %3i\n", itemGloveRightCur.AGL); + fwprintf(fpGloveRightData, L"\n"); + + // DP + fwprintf(fpGloveRightData, L"DURABILITY\n"); + fwprintf(fpGloveRightData, L"===========\n"); + fwprintf(fpGloveRightData, L"DP: %3i/%3i\n", + (itemGloveRightCur.DPCur + 99) / 100, + (itemGloveRightCur.DPMax + 99) / 100); + fwprintf(fpGloveRightData, L"\n"); + + // Type + fwprintf(fpGloveRightData, L"TYPE\n"); + fwprintf(fpGloveRightData, L"============\n"); + fwprintf(fpGloveRightData, L"Blunt: %2i\n", itemGloveRightCur.TypeBlunt); + fwprintf(fpGloveRightData, L"Edged: %2i\n", itemGloveRightCur.TypeEdged); + fwprintf(fpGloveRightData, L"Piercing: %2i\n", itemGloveRightCur.TypePiercing); + fwprintf(fpGloveRightData, L"\n"); + + // Class + fwprintf(fpGloveRightData, L"CLASS\n"); + fwprintf(fpGloveRightData, L"=============\n"); + fwprintf(fpGloveRightData, L"Human: %3i\n", itemGloveRightCur.ClassHuman); + fwprintf(fpGloveRightData, L"Beast: %3i\n", itemGloveRightCur.ClassBeast); + fwprintf(fpGloveRightData, L"Undead: %3i\n", itemGloveRightCur.ClassUndead); + fwprintf(fpGloveRightData, L"Phantom: %3i\n", itemGloveRightCur.ClassPhantom); + fwprintf(fpGloveRightData, L"Dragon: %3i\n", itemGloveRightCur.ClassDragon); + fwprintf(fpGloveRightData, L"Evil: %3i\n", itemGloveRightCur.ClassEvil); + fwprintf(fpGloveRightData, L"\n"); + + // Affinity + fwprintf(fpGloveRightData, L"AFFINITY\n"); + fwprintf(fpGloveRightData, L"=============\n"); + fwprintf( + fpGloveRightData, L"Physical: %3i\n", itemGloveRightCur.AffinityPhysical); + fwprintf(fpGloveRightData, L"Air: %3i\n", itemGloveRightCur.AffinityAir); + fwprintf(fpGloveRightData, L"Fire: %3i\n", itemGloveRightCur.AffinityFire); + fwprintf(fpGloveRightData, L"Earth: %3i\n", itemGloveRightCur.AffinityEarth); + fwprintf(fpGloveRightData, L"Water: %3i\n", itemGloveRightCur.AffinityWater); + fwprintf(fpGloveRightData, L"Light: %3i\n", itemGloveRightCur.AffinityLight); + fwprintf(fpGloveRightData, L"Dark: %3i\n", itemGloveRightCur.AffinityDark); + + fclose(fpGloveRightData); } void -WriteGloveLeftData() -{ - // Check for out-of-bound indexes - if (itemGloveLeftCur.ListPosition > _countof(ArmorsList) - 1 || // - itemGloveLeftCur.Material > _countof(CraftingMaterials) - 1) - { - return; - } - - FILE *fpGloveLeftData = fopen("game_data/armor/glove_left.txt", "w"); - - // Check if a glove is eqipped. If not, write the warning and skip the rest. - if (itemGloveLeftCur.ListPosition == 0) - { - fprintf(fpGloveLeftData, "No left glove equipped!\n"); +WriteHeadData() { + // Check for out-of-bound indexes + if (itemHeadCur.ListPosition > _countof(ArmorsList) - 1 || // + itemHeadCur.Material > _countof(CraftingMaterials) - 1) + { + return; + } - fclose(fpGloveLeftData); + FILE *fpHeadData = fopen("game_data/armor/head.txt", "w"); - return; - } - - fprintf(fpGloveLeftData, "Left Glove Stats\n\n"); - - fprintf( - fpGloveLeftData, "Name: %s\n", ArmorsList[itemGloveLeftCur.ListPosition]); - fprintf(fpGloveLeftData, "Material: %s\n", - CraftingMaterials[itemGloveLeftCur.Material]); - fprintf(fpGloveLeftData, "\n"); - - // Bonuses - fprintf(fpGloveLeftData, "BONUSES\n"); - fprintf(fpGloveLeftData, "========\n"); - fprintf(fpGloveLeftData, "STR: %3i\n", itemGloveLeftCur.STR); - fprintf(fpGloveLeftData, "INT: %3i\n", itemGloveLeftCur.INT); - fprintf(fpGloveLeftData, "AGL: %3i\n", itemGloveLeftCur.AGL); - fprintf(fpGloveLeftData, "\n"); - - // DP - fprintf(fpGloveLeftData, "DURABILITY\n"); - fprintf(fpGloveLeftData, "===========\n"); - fprintf(fpGloveLeftData, "DP: %3i/%3i\n", (itemGloveLeftCur.DPCur + 99) / 100, - (itemGloveLeftCur.DPMax + 99) / 100); - fprintf(fpGloveLeftData, "\n"); - - // Type - fprintf(fpGloveLeftData, "TYPE\n"); - fprintf(fpGloveLeftData, "============\n"); - fprintf(fpGloveLeftData, "Blunt: %2i\n", itemGloveLeftCur.TypeBlunt); - fprintf(fpGloveLeftData, "Edged: %2i\n", itemGloveLeftCur.TypeEdged); - fprintf(fpGloveLeftData, "Piercing: %2i\n", itemGloveLeftCur.TypePiercing); - fprintf(fpGloveLeftData, "\n"); - - // Class - fprintf(fpGloveLeftData, "CLASS\n"); - fprintf(fpGloveLeftData, "=============\n"); - fprintf(fpGloveLeftData, "Human: %3i\n", itemGloveLeftCur.ClassHuman); - fprintf(fpGloveLeftData, "Beast: %3i\n", itemGloveLeftCur.ClassBeast); - fprintf(fpGloveLeftData, "Undead: %3i\n", itemGloveLeftCur.ClassUndead); - fprintf(fpGloveLeftData, "Phantom: %3i\n", itemGloveLeftCur.ClassPhantom); - fprintf(fpGloveLeftData, "Dragon: %3i\n", itemGloveLeftCur.ClassDragon); - fprintf(fpGloveLeftData, "Evil: %3i\n", itemGloveLeftCur.ClassEvil); - fprintf(fpGloveLeftData, "\n"); - - // Affinity - fprintf(fpGloveLeftData, "AFFINITY\n"); - fprintf(fpGloveLeftData, "=============\n"); - fprintf( - fpGloveLeftData, "Physical: %3i\n", itemGloveLeftCur.AffinityPhysical); - fprintf(fpGloveLeftData, "Air: %3i\n", itemGloveLeftCur.AffinityAir); - fprintf(fpGloveLeftData, "Fire: %3i\n", itemGloveLeftCur.AffinityFire); - fprintf(fpGloveLeftData, "Earth: %3i\n", itemGloveLeftCur.AffinityEarth); - fprintf(fpGloveLeftData, "Water: %3i\n", itemGloveLeftCur.AffinityWater); - fprintf(fpGloveLeftData, "Light: %3i\n", itemGloveLeftCur.AffinityLight); - fprintf(fpGloveLeftData, "Dark: %3i\n", itemGloveLeftCur.AffinityDark); - - fclose(fpGloveLeftData); -} + // Check if a head armor is eqipped. + // If not, write the warning and skip the rest. + if (itemHeadCur.ListPosition == 0) { + fwprintf(fpHeadData, L"No head armor equipped!\n"); + fclose(fpHeadData); -void -WriteGloveRightData() -{ - // Check for out-of-bound indexes - if (itemGloveRightCur.ListPosition > _countof(ArmorsList) - 1 || // - itemGloveRightCur.Material > _countof(CraftingMaterials) - 1) - { - return; - } - - FILE *fpGloveRightData = fopen("game_data/armor/glove_right.txt", "w"); - - // Check if a glove is eqipped. If not, write the warning and skip the rest. - if (itemGloveRightCur.ListPosition == 0) - { - fprintf(fpGloveRightData, "No left glove equipped!\n"); + return; + } - fclose(fpGloveRightData); + fwprintf(fpHeadData, L"Helm Stats\n\n"); + + fwprintf(fpHeadData, L"Name: %s\n", ArmorsList[itemHeadCur.ListPosition]); + fwprintf( + fpHeadData, L"Material: %s\n", CraftingMaterials[itemHeadCur.Material]); + fwprintf(fpHeadData, L"\n"); + + // Bonuses + fwprintf(fpHeadData, L"BONUSES\n"); + fwprintf(fpHeadData, L"========\n"); + fwprintf(fpHeadData, L"STR: %3i\n", itemHeadCur.STR); + fwprintf(fpHeadData, L"INT: %3i\n", itemHeadCur.INT); + fwprintf(fpHeadData, L"AGL: %3i\n", itemHeadCur.AGL); + fwprintf(fpHeadData, L"\n"); + + // DP + fwprintf(fpHeadData, L"DURABILITY\n"); + fwprintf(fpHeadData, L"===========\n"); + fwprintf(fpHeadData, L"DP: %3i/%3i\n", (itemHeadCur.DPCur + 99) / 100, + (itemHeadCur.DPMax + 99) / 100); + fwprintf(fpHeadData, L"\n"); + + // Type + fwprintf(fpHeadData, L"TYPE\n"); + fwprintf(fpHeadData, L"============\n"); + fwprintf(fpHeadData, L"Blunt: %2i\n", itemHeadCur.TypeBlunt); + fwprintf(fpHeadData, L"Edged: %2i\n", itemHeadCur.TypeEdged); + fwprintf(fpHeadData, L"Piercing: %2i\n", itemHeadCur.TypePiercing); + fwprintf(fpHeadData, L"\n"); + + // Class + fwprintf(fpHeadData, L"CLASS\n"); + fwprintf(fpHeadData, L"=============\n"); + fwprintf(fpHeadData, L"Human: %3i\n", itemHeadCur.ClassHuman); + fwprintf(fpHeadData, L"Beast: %3i\n", itemHeadCur.ClassBeast); + fwprintf(fpHeadData, L"Undead: %3i\n", itemHeadCur.ClassUndead); + fwprintf(fpHeadData, L"Phantom: %3i\n", itemHeadCur.ClassPhantom); + fwprintf(fpHeadData, L"Dragon: %3i\n", itemHeadCur.ClassDragon); + fwprintf(fpHeadData, L"Evil: %3i\n", itemHeadCur.ClassEvil); + fwprintf(fpHeadData, L"\n"); + + // Affinity + fwprintf(fpHeadData, L"AFFINITY\n"); + fwprintf(fpHeadData, L"=============\n"); + fwprintf(fpHeadData, L"Physical: %3i\n", itemHeadCur.AffinityPhysical); + fwprintf(fpHeadData, L"Air: %3i\n", itemHeadCur.AffinityAir); + fwprintf(fpHeadData, L"Fire: %3i\n", itemHeadCur.AffinityFire); + fwprintf(fpHeadData, L"Earth: %3i\n", itemHeadCur.AffinityEarth); + fwprintf(fpHeadData, L"Water: %3i\n", itemHeadCur.AffinityWater); + fwprintf(fpHeadData, L"Light: %3i\n", itemHeadCur.AffinityLight); + fwprintf(fpHeadData, L"Dark: %3i\n", itemHeadCur.AffinityDark); - return; - } - - fprintf(fpGloveRightData, "Right Glove Stats\n\n"); - - fprintf(fpGloveRightData, "Name: %s\n", - ArmorsList[itemGloveRightCur.ListPosition]); - fprintf(fpGloveRightData, "Material: %s\n", - CraftingMaterials[itemGloveRightCur.Material]); - fprintf(fpGloveRightData, "\n"); - - // Bonuses - fprintf(fpGloveRightData, "BONUSES\n"); - fprintf(fpGloveRightData, "========\n"); - fprintf(fpGloveRightData, "STR: %3i\n", itemGloveRightCur.STR); - fprintf(fpGloveRightData, "INT: %3i\n", itemGloveRightCur.INT); - fprintf(fpGloveRightData, "AGL: %3i\n", itemGloveRightCur.AGL); - fprintf(fpGloveRightData, "\n"); - - // DP - fprintf(fpGloveRightData, "DURABILITY\n"); - fprintf(fpGloveRightData, "===========\n"); - fprintf(fpGloveRightData, "DP: %3i/%3i\n", - (itemGloveRightCur.DPCur + 99) / 100, - (itemGloveRightCur.DPMax + 99) / 100); - fprintf(fpGloveRightData, "\n"); - - // Type - fprintf(fpGloveRightData, "TYPE\n"); - fprintf(fpGloveRightData, "============\n"); - fprintf(fpGloveRightData, "Blunt: %2i\n", itemGloveRightCur.TypeBlunt); - fprintf(fpGloveRightData, "Edged: %2i\n", itemGloveRightCur.TypeEdged); - fprintf(fpGloveRightData, "Piercing: %2i\n", itemGloveRightCur.TypePiercing); - fprintf(fpGloveRightData, "\n"); - - // Class - fprintf(fpGloveRightData, "CLASS\n"); - fprintf(fpGloveRightData, "=============\n"); - fprintf(fpGloveRightData, "Human: %3i\n", itemGloveRightCur.ClassHuman); - fprintf(fpGloveRightData, "Beast: %3i\n", itemGloveRightCur.ClassBeast); - fprintf(fpGloveRightData, "Undead: %3i\n", itemGloveRightCur.ClassUndead); - fprintf(fpGloveRightData, "Phantom: %3i\n", itemGloveRightCur.ClassPhantom); - fprintf(fpGloveRightData, "Dragon: %3i\n", itemGloveRightCur.ClassDragon); - fprintf(fpGloveRightData, "Evil: %3i\n", itemGloveRightCur.ClassEvil); - fprintf(fpGloveRightData, "\n"); - - // Affinity - fprintf(fpGloveRightData, "AFFINITY\n"); - fprintf(fpGloveRightData, "=============\n"); - fprintf( - fpGloveRightData, "Physical: %3i\n", itemGloveRightCur.AffinityPhysical); - fprintf(fpGloveRightData, "Air: %3i\n", itemGloveRightCur.AffinityAir); - fprintf(fpGloveRightData, "Fire: %3i\n", itemGloveRightCur.AffinityFire); - fprintf(fpGloveRightData, "Earth: %3i\n", itemGloveRightCur.AffinityEarth); - fprintf(fpGloveRightData, "Water: %3i\n", itemGloveRightCur.AffinityWater); - fprintf(fpGloveRightData, "Light: %3i\n", itemGloveRightCur.AffinityLight); - fprintf(fpGloveRightData, "Dark: %3i\n", itemGloveRightCur.AffinityDark); - - fclose(fpGloveRightData); + fclose(fpHeadData); } void -WriteHeadData() -{ - // Check for out-of-bound indexes - if (itemHeadCur.ListPosition > _countof(ArmorsList) - 1 || // - itemHeadCur.Material > _countof(CraftingMaterials) - 1) - { - return; - } - - FILE *fpHeadData = fopen("game_data/armor/head.txt", "w"); - - // Check if a head armor is eqipped. - // If not, write the warning and skip the rest. - if (itemHeadCur.ListPosition == 0) - { - fprintf(fpHeadData, "No head armor equipped!\n"); - fclose(fpHeadData); +WriteBodyData() { + // Check for out-of-bound indexes + if (itemBodyCur.ListPosition > _countof(ArmorsList) - 1 || // + itemBodyCur.Material > _countof(CraftingMaterials) - 1) + { + return; + } - return; - } - - fprintf(fpHeadData, "Helm Stats\n\n"); - - fprintf(fpHeadData, "Name: %s\n", ArmorsList[itemHeadCur.ListPosition]); - fprintf( - fpHeadData, "Material: %s\n", CraftingMaterials[itemHeadCur.Material]); - fprintf(fpHeadData, "\n"); - - // Bonuses - fprintf(fpHeadData, "BONUSES\n"); - fprintf(fpHeadData, "========\n"); - fprintf(fpHeadData, "STR: %3i\n", itemHeadCur.STR); - fprintf(fpHeadData, "INT: %3i\n", itemHeadCur.INT); - fprintf(fpHeadData, "AGL: %3i\n", itemHeadCur.AGL); - fprintf(fpHeadData, "\n"); - - // DP - fprintf(fpHeadData, "DURABILITY\n"); - fprintf(fpHeadData, "===========\n"); - fprintf(fpHeadData, "DP: %3i/%3i\n", (itemHeadCur.DPCur + 99) / 100, - (itemHeadCur.DPMax + 99) / 100); - fprintf(fpHeadData, "\n"); - - // Type - fprintf(fpHeadData, "TYPE\n"); - fprintf(fpHeadData, "============\n"); - fprintf(fpHeadData, "Blunt: %2i\n", itemHeadCur.TypeBlunt); - fprintf(fpHeadData, "Edged: %2i\n", itemHeadCur.TypeEdged); - fprintf(fpHeadData, "Piercing: %2i\n", itemHeadCur.TypePiercing); - fprintf(fpHeadData, "\n"); - - // Class - fprintf(fpHeadData, "CLASS\n"); - fprintf(fpHeadData, "=============\n"); - fprintf(fpHeadData, "Human: %3i\n", itemHeadCur.ClassHuman); - fprintf(fpHeadData, "Beast: %3i\n", itemHeadCur.ClassBeast); - fprintf(fpHeadData, "Undead: %3i\n", itemHeadCur.ClassUndead); - fprintf(fpHeadData, "Phantom: %3i\n", itemHeadCur.ClassPhantom); - fprintf(fpHeadData, "Dragon: %3i\n", itemHeadCur.ClassDragon); - fprintf(fpHeadData, "Evil: %3i\n", itemHeadCur.ClassEvil); - fprintf(fpHeadData, "\n"); - - // Affinity - fprintf(fpHeadData, "AFFINITY\n"); - fprintf(fpHeadData, "=============\n"); - fprintf(fpHeadData, "Physical: %3i\n", itemHeadCur.AffinityPhysical); - fprintf(fpHeadData, "Air: %3i\n", itemHeadCur.AffinityAir); - fprintf(fpHeadData, "Fire: %3i\n", itemHeadCur.AffinityFire); - fprintf(fpHeadData, "Earth: %3i\n", itemHeadCur.AffinityEarth); - fprintf(fpHeadData, "Water: %3i\n", itemHeadCur.AffinityWater); - fprintf(fpHeadData, "Light: %3i\n", itemHeadCur.AffinityLight); - fprintf(fpHeadData, "Dark: %3i\n", itemHeadCur.AffinityDark); - - fclose(fpHeadData); -} + FILE *fpBodyData = fopen("game_data/armor/body.txt", "w"); -void -WriteBodyData() -{ - // Check for out-of-bound indexes - if (itemBodyCur.ListPosition > _countof(ArmorsList) - 1 || // - itemBodyCur.Material > _countof(CraftingMaterials) - 1) - { - return; - } - - FILE *fpBodyData = fopen("game_data/armor/body.txt", "w"); - - // Check if a body armor is eqipped. If not, write the warning and skip the - // rest. - if (itemBodyCur.ListPosition == 0) - { - // fprintf(fpBodyData, "No body armor equipped!\n"); - fprintf(fpBodyData, "No Breastplate Equipped!\n"); - fclose(fpBodyData); + // Check if a body armor is eqipped. If not, write the warning and skip the + // rest. + if (itemBodyCur.ListPosition == 0) { + // fwprintf(fpBodyData, L"No body armor equipped!\n"); + fwprintf(fpBodyData, L"No Breastplate Equipped!\n"); + fclose(fpBodyData); - return; - } - - fprintf(fpBodyData, "Body Armor Stats\n\n"); - - fprintf(fpBodyData, "Name: %s\n", ArmorsList[itemBodyCur.ListPosition]); - fprintf( - fpBodyData, "Material: %s\n", CraftingMaterials[itemBodyCur.Material]); - fprintf(fpBodyData, "\n"); - - // Bonuses - fprintf(fpBodyData, "BONUSES\n"); - fprintf(fpBodyData, "========\n"); - fprintf(fpBodyData, "STR: %3i\n", itemBodyCur.STR); - fprintf(fpBodyData, "INT: %3i\n", itemBodyCur.INT); - fprintf(fpBodyData, "AGL: %3i\n", itemBodyCur.AGL); - fprintf(fpBodyData, "\n"); - - // DP - fprintf(fpBodyData, "DURABILITY\n"); - fprintf(fpBodyData, "===========\n"); - fprintf(fpBodyData, "DP: %3i/%3i\n", (itemBodyCur.DPCur + 99) / 100, - (itemBodyCur.DPMax + 99) / 100); - fprintf(fpBodyData, "\n"); - - // Type - fprintf(fpBodyData, "TYPE\n"); - fprintf(fpBodyData, "============\n"); - fprintf(fpBodyData, "Blunt: %2i\n", itemBodyCur.TypeBlunt); - fprintf(fpBodyData, "Edged: %2i\n", itemBodyCur.TypeEdged); - fprintf(fpBodyData, "Piercing: %2i\n", itemBodyCur.TypePiercing); - fprintf(fpBodyData, "\n"); - - // Class - fprintf(fpBodyData, "CLASS\n"); - fprintf(fpBodyData, "=============\n"); - fprintf(fpBodyData, "Human: %3i\n", itemBodyCur.ClassHuman); - fprintf(fpBodyData, "Beast: %3i\n", itemBodyCur.ClassBeast); - fprintf(fpBodyData, "Undead: %3i\n", itemBodyCur.ClassUndead); - fprintf(fpBodyData, "Phantom: %3i\n", itemBodyCur.ClassPhantom); - fprintf(fpBodyData, "Dragon: %3i\n", itemBodyCur.ClassDragon); - fprintf(fpBodyData, "Evil: %3i\n", itemBodyCur.ClassEvil); - fprintf(fpBodyData, "\n"); - - // Affinity - fprintf(fpBodyData, "AFFINITY\n"); - fprintf(fpBodyData, "=============\n"); - fprintf(fpBodyData, "Physical: %3i\n", itemBodyCur.AffinityPhysical); - fprintf(fpBodyData, "Air: %3i\n", itemBodyCur.AffinityAir); - fprintf(fpBodyData, "Fire: %3i\n", itemBodyCur.AffinityFire); - fprintf(fpBodyData, "Earth: %3i\n", itemBodyCur.AffinityEarth); - fprintf(fpBodyData, "Water: %3i\n", itemBodyCur.AffinityWater); - fprintf(fpBodyData, "Light: %3i\n", itemBodyCur.AffinityLight); - fprintf(fpBodyData, "Dark: %3i\n", itemBodyCur.AffinityDark); - - fclose(fpBodyData); + return; + } + + fwprintf(fpBodyData, L"Body Armor Stats\n\n"); + + fwprintf(fpBodyData, L"Name: %s\n", ArmorsList[itemBodyCur.ListPosition]); + fwprintf( + fpBodyData, L"Material: %s\n", CraftingMaterials[itemBodyCur.Material]); + fwprintf(fpBodyData, L"\n"); + + // Bonuses + fwprintf(fpBodyData, L"BONUSES\n"); + fwprintf(fpBodyData, L"========\n"); + fwprintf(fpBodyData, L"STR: %3i\n", itemBodyCur.STR); + fwprintf(fpBodyData, L"INT: %3i\n", itemBodyCur.INT); + fwprintf(fpBodyData, L"AGL: %3i\n", itemBodyCur.AGL); + fwprintf(fpBodyData, L"\n"); + + // DP + fwprintf(fpBodyData, L"DURABILITY\n"); + fwprintf(fpBodyData, L"===========\n"); + fwprintf(fpBodyData, L"DP: %3i/%3i\n", (itemBodyCur.DPCur + 99) / 100, + (itemBodyCur.DPMax + 99) / 100); + fwprintf(fpBodyData, L"\n"); + + // Type + fwprintf(fpBodyData, L"TYPE\n"); + fwprintf(fpBodyData, L"============\n"); + fwprintf(fpBodyData, L"Blunt: %2i\n", itemBodyCur.TypeBlunt); + fwprintf(fpBodyData, L"Edged: %2i\n", itemBodyCur.TypeEdged); + fwprintf(fpBodyData, L"Piercing: %2i\n", itemBodyCur.TypePiercing); + fwprintf(fpBodyData, L"\n"); + + // Class + fwprintf(fpBodyData, L"CLASS\n"); + fwprintf(fpBodyData, L"=============\n"); + fwprintf(fpBodyData, L"Human: %3i\n", itemBodyCur.ClassHuman); + fwprintf(fpBodyData, L"Beast: %3i\n", itemBodyCur.ClassBeast); + fwprintf(fpBodyData, L"Undead: %3i\n", itemBodyCur.ClassUndead); + fwprintf(fpBodyData, L"Phantom: %3i\n", itemBodyCur.ClassPhantom); + fwprintf(fpBodyData, L"Dragon: %3i\n", itemBodyCur.ClassDragon); + fwprintf(fpBodyData, L"Evil: %3i\n", itemBodyCur.ClassEvil); + fwprintf(fpBodyData, L"\n"); + + // Affinity + fwprintf(fpBodyData, L"AFFINITY\n"); + fwprintf(fpBodyData, L"=============\n"); + fwprintf(fpBodyData, L"Physical: %3i\n", itemBodyCur.AffinityPhysical); + fwprintf(fpBodyData, L"Air: %3i\n", itemBodyCur.AffinityAir); + fwprintf(fpBodyData, L"Fire: %3i\n", itemBodyCur.AffinityFire); + fwprintf(fpBodyData, L"Earth: %3i\n", itemBodyCur.AffinityEarth); + fwprintf(fpBodyData, L"Water: %3i\n", itemBodyCur.AffinityWater); + fwprintf(fpBodyData, L"Light: %3i\n", itemBodyCur.AffinityLight); + fwprintf(fpBodyData, L"Dark: %3i\n", itemBodyCur.AffinityDark); + + fclose(fpBodyData); } void -WriteLegsData() -{ - // Check for out-of-bound indexes - if (itemLegsCur.ListPosition > _countof(ArmorsList) - 1 || // - itemLegsCur.Material > _countof(CraftingMaterials) - 1) - { - return; - } - - FILE *fpLegsData = fopen("game_data/armor/legs.txt", "w"); - - // Check if a leg armor is eqipped. - // If not, write the warning and skip the rest. - if (itemLegsCur.ListPosition == 0) - { - fprintf(fpLegsData, "No legs armor equipped!\n"); - fclose(fpLegsData); +WriteLegsData() { + // Check for out-of-bound indexes + if (itemLegsCur.ListPosition > _countof(ArmorsList) - 1 || // + itemLegsCur.Material > _countof(CraftingMaterials) - 1) + { + return; + } + + FILE *fpLegsData = fopen("game_data/armor/legs.txt", "w"); + + // Check if a leg armor is eqipped. + // If not, write the warning and skip the rest. + if (itemLegsCur.ListPosition == 0) { + fwprintf(fpLegsData, L"No legs armor equipped!\n"); + fclose(fpLegsData); + + return; + } + + fwprintf(fpLegsData, L"Leggings Stats\n\n"); + + fwprintf(fpLegsData, L"Name: %s\n", ArmorsList[itemLegsCur.ListPosition]); + fwprintf( + fpLegsData, L"Material: %s\n", CraftingMaterials[itemLegsCur.Material]); + fwprintf(fpLegsData, L"\n"); + + // Bonuses + fwprintf(fpLegsData, L"BONUSES\n"); + fwprintf(fpLegsData, L"========\n"); + fwprintf(fpLegsData, L"STR: %3i\n", itemLegsCur.STR); + fwprintf(fpLegsData, L"INT: %3i\n", itemLegsCur.INT); + fwprintf(fpLegsData, L"AGL: %3i\n", itemLegsCur.AGL); + fwprintf(fpLegsData, L"\n"); + + // DP + fwprintf(fpLegsData, L"DURABILITY\n"); + fwprintf(fpLegsData, L"===========\n"); + fwprintf(fpLegsData, L"DP: %3i/%3i\n", (itemLegsCur.DPCur + 99) / 100, + (itemLegsCur.DPMax + 99) / 100); + fwprintf(fpLegsData, L"\n"); + + // Type + fwprintf(fpLegsData, L"TYPE\n"); + fwprintf(fpLegsData, L"============\n"); + fwprintf(fpLegsData, L"Blunt: %2i\n", itemLegsCur.TypeBlunt); + fwprintf(fpLegsData, L"Edged: %2i\n", itemLegsCur.TypeEdged); + fwprintf(fpLegsData, L"Piercing: %2i\n", itemLegsCur.TypePiercing); + fwprintf(fpLegsData, L"\n"); + + // Class + fwprintf(fpLegsData, L"CLASS\n"); + fwprintf(fpLegsData, L"=============\n"); + fwprintf(fpLegsData, L"Human: %3i\n", itemLegsCur.ClassHuman); + fwprintf(fpLegsData, L"Beast: %3i\n", itemLegsCur.ClassBeast); + fwprintf(fpLegsData, L"Undead: %3i\n", itemLegsCur.ClassUndead); + fwprintf(fpLegsData, L"Phantom: %3i\n", itemLegsCur.ClassPhantom); + fwprintf(fpLegsData, L"Dragon: %3i\n", itemLegsCur.ClassDragon); + fwprintf(fpLegsData, L"Evil: %3i\n", itemLegsCur.ClassEvil); + fwprintf(fpLegsData, L"\n"); + + // Affinity + fwprintf(fpLegsData, L"AFFINITY\n"); + fwprintf(fpLegsData, L"=============\n"); + fwprintf(fpLegsData, L"Physical: %3i\n", itemLegsCur.AffinityPhysical); + fwprintf(fpLegsData, L"Air: %3i\n", itemLegsCur.AffinityAir); + fwprintf(fpLegsData, L"Fire: %3i\n", itemLegsCur.AffinityFire); + fwprintf(fpLegsData, L"Earth: %3i\n", itemLegsCur.AffinityEarth); + fwprintf(fpLegsData, L"Water: %3i\n", itemLegsCur.AffinityWater); + fwprintf(fpLegsData, L"Light: %3i\n", itemLegsCur.AffinityLight); + fwprintf(fpLegsData, L"Dark: %3i\n", itemLegsCur.AffinityDark); - return; - } - - fprintf(fpLegsData, "Leggings Stats\n\n"); - - fprintf(fpLegsData, "Name: %s\n", ArmorsList[itemLegsCur.ListPosition]); - fprintf( - fpLegsData, "Material: %s\n", CraftingMaterials[itemLegsCur.Material]); - fprintf(fpLegsData, "\n"); - - // Bonuses - fprintf(fpLegsData, "BONUSES\n"); - fprintf(fpLegsData, "========\n"); - fprintf(fpLegsData, "STR: %3i\n", itemLegsCur.STR); - fprintf(fpLegsData, "INT: %3i\n", itemLegsCur.INT); - fprintf(fpLegsData, "AGL: %3i\n", itemLegsCur.AGL); - fprintf(fpLegsData, "\n"); - - // DP - fprintf(fpLegsData, "DURABILITY\n"); - fprintf(fpLegsData, "===========\n"); - fprintf(fpLegsData, "DP: %3i/%3i\n", (itemLegsCur.DPCur + 99) / 100, - (itemLegsCur.DPMax + 99) / 100); - fprintf(fpLegsData, "\n"); - - // Type - fprintf(fpLegsData, "TYPE\n"); - fprintf(fpLegsData, "============\n"); - fprintf(fpLegsData, "Blunt: %2i\n", itemLegsCur.TypeBlunt); - fprintf(fpLegsData, "Edged: %2i\n", itemLegsCur.TypeEdged); - fprintf(fpLegsData, "Piercing: %2i\n", itemLegsCur.TypePiercing); - fprintf(fpLegsData, "\n"); - - // Class - fprintf(fpLegsData, "CLASS\n"); - fprintf(fpLegsData, "=============\n"); - fprintf(fpLegsData, "Human: %3i\n", itemLegsCur.ClassHuman); - fprintf(fpLegsData, "Beast: %3i\n", itemLegsCur.ClassBeast); - fprintf(fpLegsData, "Undead: %3i\n", itemLegsCur.ClassUndead); - fprintf(fpLegsData, "Phantom: %3i\n", itemLegsCur.ClassPhantom); - fprintf(fpLegsData, "Dragon: %3i\n", itemLegsCur.ClassDragon); - fprintf(fpLegsData, "Evil: %3i\n", itemLegsCur.ClassEvil); - fprintf(fpLegsData, "\n"); - - // Affinity - fprintf(fpLegsData, "AFFINITY\n"); - fprintf(fpLegsData, "=============\n"); - fprintf(fpLegsData, "Physical: %3i\n", itemLegsCur.AffinityPhysical); - fprintf(fpLegsData, "Air: %3i\n", itemLegsCur.AffinityAir); - fprintf(fpLegsData, "Fire: %3i\n", itemLegsCur.AffinityFire); - fprintf(fpLegsData, "Earth: %3i\n", itemLegsCur.AffinityEarth); - fprintf(fpLegsData, "Water: %3i\n", itemLegsCur.AffinityWater); - fprintf(fpLegsData, "Light: %3i\n", itemLegsCur.AffinityLight); - fprintf(fpLegsData, "Dark: %3i\n", itemLegsCur.AffinityDark); - - fclose(fpLegsData); + fclose(fpLegsData); } void -WriteNeckData() -{ - u8 ListPositionMax = 127; - u8 ListPositionMin = (ListPositionMax - (_countof(AccessoriesList) - 1)); - // Check for out-of-bound indexes - if (itemNeckCur.NamesListPosition > _countof(ItemNamesList)) - { - return; - } - - FILE *fpNeckData = fopen("game_data/armor/neck.txt", "w"); - - // Check if a necklace is eqipped. - // If not, write the warning and skip the rest. - if (itemNeckCur.ListPosition < ListPositionMin || - itemNeckCur.ListPosition > ListPositionMax) - { - fprintf(fpNeckData, "No necklace equipped!\n"); - fclose(fpNeckData); +WriteNeckData() { + u8 ListPositionMax = 127; + u8 ListPositionMin = (ListPositionMax - (_countof(AccessoriesList) - 1)); + // Check for out-of-bound indexes + if (itemNeckCur.NamesListPosition > _countof(ItemNamesList)) + { + return; + } + + FILE *fpNeckData = fopen("game_data/armor/neck.txt", "w"); - return; - } - - fprintf(fpNeckData, "Necklace Stats\n\n"); - - fprintf( - fpNeckData, "Name: %s\n", ItemNamesList[itemNeckCur.NamesListPosition]); - fprintf(fpNeckData, "\n"); - - // Bonuses - fprintf(fpNeckData, "BONUSES\n"); - fprintf(fpNeckData, "========\n"); - fprintf(fpNeckData, "STR: %3i\n", itemNeckCur.STR); - fprintf(fpNeckData, "INT: %3i\n", itemNeckCur.INT); - fprintf(fpNeckData, "AGL: %3i\n", itemNeckCur.AGL); - fprintf(fpNeckData, "\n"); - - // Type - fprintf(fpNeckData, "TYPE\n"); - fprintf(fpNeckData, "============\n"); - fprintf(fpNeckData, "Blunt: %2i\n", itemNeckCur.TypeBlunt); - fprintf(fpNeckData, "Edged: %2i\n", itemNeckCur.TypeEdged); - fprintf(fpNeckData, "Piercing: %2i\n", itemNeckCur.TypePiercing); - fprintf(fpNeckData, "\n"); - - // Class - fprintf(fpNeckData, "CLASS\n"); - fprintf(fpNeckData, "=============\n"); - fprintf(fpNeckData, "Human: %3i\n", itemNeckCur.ClassHuman); - fprintf(fpNeckData, "Beast: %3i\n", itemNeckCur.ClassBeast); - fprintf(fpNeckData, "Undead: %3i\n", itemNeckCur.ClassUndead); - fprintf(fpNeckData, "Phantom: %3i\n", itemNeckCur.ClassPhantom); - fprintf(fpNeckData, "Dragon: %3i\n", itemNeckCur.ClassDragon); - fprintf(fpNeckData, "Evil: %3i\n", itemNeckCur.ClassEvil); - fprintf(fpNeckData, "\n"); - - // Affinity - fprintf(fpNeckData, "AFFINITY\n"); - fprintf(fpNeckData, "=============\n"); - fprintf(fpNeckData, "Physical: %3i\n", itemNeckCur.AffinityPhysical); - fprintf(fpNeckData, "Air: %3i\n", itemNeckCur.AffinityAir); - fprintf(fpNeckData, "Fire: %3i\n", itemNeckCur.AffinityFire); - fprintf(fpNeckData, "Earth: %3i\n", itemNeckCur.AffinityEarth); - fprintf(fpNeckData, "Water: %3i\n", itemNeckCur.AffinityWater); - fprintf(fpNeckData, "Light: %3i\n", itemNeckCur.AffinityLight); - fprintf(fpNeckData, "Dark: %3i\n", itemNeckCur.AffinityDark); - - fclose(fpNeckData); + // Check if a necklace is eqipped. + // If not, write the warning and skip the rest. + if (itemNeckCur.ListPosition < ListPositionMin || + itemNeckCur.ListPosition > ListPositionMax) + { + fwprintf(fpNeckData, L"No necklace equipped!\n"); + fclose(fpNeckData); + + return; + } + + fwprintf(fpNeckData, L"Necklace Stats\n\n"); + + fwprintf( + fpNeckData, L"Name: %s\n", ItemNamesList[itemNeckCur.NamesListPosition]); + fwprintf(fpNeckData, L"\n"); + + // Bonuses + fwprintf(fpNeckData, L"BONUSES\n"); + fwprintf(fpNeckData, L"========\n"); + fwprintf(fpNeckData, L"STR: %3i\n", itemNeckCur.STR); + fwprintf(fpNeckData, L"INT: %3i\n", itemNeckCur.INT); + fwprintf(fpNeckData, L"AGL: %3i\n", itemNeckCur.AGL); + fwprintf(fpNeckData, L"\n"); + + // Type + fwprintf(fpNeckData, L"TYPE\n"); + fwprintf(fpNeckData, L"============\n"); + fwprintf(fpNeckData, L"Blunt: %2i\n", itemNeckCur.TypeBlunt); + fwprintf(fpNeckData, L"Edged: %2i\n", itemNeckCur.TypeEdged); + fwprintf(fpNeckData, L"Piercing: %2i\n", itemNeckCur.TypePiercing); + fwprintf(fpNeckData, L"\n"); + + // Class + fwprintf(fpNeckData, L"CLASS\n"); + fwprintf(fpNeckData, L"=============\n"); + fwprintf(fpNeckData, L"Human: %3i\n", itemNeckCur.ClassHuman); + fwprintf(fpNeckData, L"Beast: %3i\n", itemNeckCur.ClassBeast); + fwprintf(fpNeckData, L"Undead: %3i\n", itemNeckCur.ClassUndead); + fwprintf(fpNeckData, L"Phantom: %3i\n", itemNeckCur.ClassPhantom); + fwprintf(fpNeckData, L"Dragon: %3i\n", itemNeckCur.ClassDragon); + fwprintf(fpNeckData, L"Evil: %3i\n", itemNeckCur.ClassEvil); + fwprintf(fpNeckData, L"\n"); + + // Affinity + fwprintf(fpNeckData, L"AFFINITY\n"); + fwprintf(fpNeckData, L"=============\n"); + fwprintf(fpNeckData, L"Physical: %3i\n", itemNeckCur.AffinityPhysical); + fwprintf(fpNeckData, L"Air: %3i\n", itemNeckCur.AffinityAir); + fwprintf(fpNeckData, L"Fire: %3i\n", itemNeckCur.AffinityFire); + fwprintf(fpNeckData, L"Earth: %3i\n", itemNeckCur.AffinityEarth); + fwprintf(fpNeckData, L"Water: %3i\n", itemNeckCur.AffinityWater); + fwprintf(fpNeckData, L"Light: %3i\n", itemNeckCur.AffinityLight); + fwprintf(fpNeckData, L"Dark: %3i\n", itemNeckCur.AffinityDark); + + fclose(fpNeckData); } void -WriteArmorData() -{ - WriteGloveLeftData(); - WriteGloveRightData(); - WriteHeadData(); - WriteBodyData(); - WriteLegsData(); - WriteNeckData(); +WriteArmorData() { + WriteGloveLeftData(); + WriteGloveRightData(); + WriteHeadData(); + WriteBodyData(); + WriteLegsData(); + WriteNeckData(); } #endif diff --git a/includes/vst_gazette.h b/includes/vst_gazette.h index 643b226..9e888ea 100644 --- a/includes/vst_gazette.h +++ b/includes/vst_gazette.h @@ -33,579 +33,532 @@ // This is used to generate list of missing treasure chests chest_flag_check ChestFlagChecklist[CHEST_COUNT_MAX] = { // - { 1, 11, 0 }, { 2, 12, 0 }, { 3, 15, 3 }, { 4, 25, 0 }, // - { 5, 40, 24 }, { 11, 51, 8 }, { 12, 9, 9 }, { 13, 53, 22 }, // - { 14, 53, 15 }, { 15, 50, 14 }, { 16, 13, 5 }, { 17, 13, 9 }, // - { 18, 13, 4 }, { 19, 40, 23 }, { 20, 9, 16 }, { 21, 24, 0 }, // - { 22, 53, 25 }, { 23, 53, 5 }, { 24, 53, 20 }, { 25, 55, 20 }, // - { 26, 55, 21 }, { 27, 55, 19 }, { 28, 56, 15 }, { 29, 56, 17 }, // - { 30, 56, 25 }, { 31, 12, 1 }, { 32, 36, 0 }, { 33, 51, 22 }, // - { 34, 51, 11 }, { 38, 38, 0 }, { 39, 24, 2 }, { 40, 50, 1 }, // - { 42, 50, 16 }, { 45, 54, 4 }, { 46, 52, 1 }, { 47, 9, 17 }, // - { 48, 48, 7 }, { 49, 49, 12 }, { 50, 41, 2 }, { 51, 51, 5 }, // - { 52, 54, 2 }, { 53, 48, 20 }, { 54, 49, 8 }, { 55, 49, 7 }, // - { 56, 55, 22 }, { 57, 30, 3 }, { 58, 48, 21 }, { 59, 50, 10 }, // - { 60, 37, 0 }, { 61, 56, 23 }, { 62, 52, 7 }, { 63, 29, 0 } + { 1, 11, 0 }, { 2, 12, 0 }, { 3, 15, 3 }, { 4, 25, 0 }, // + { 5, 40, 24 }, { 11, 51, 8 }, { 12, 9, 9 }, { 13, 53, 22 }, // + { 14, 53, 15 }, { 15, 50, 14 }, { 16, 13, 5 }, { 17, 13, 9 }, // + { 18, 13, 4 }, { 19, 40, 23 }, { 20, 9, 16 }, { 21, 24, 0 }, // + { 22, 53, 25 }, { 23, 53, 5 }, { 24, 53, 20 }, { 25, 55, 20 }, // + { 26, 55, 21 }, { 27, 55, 19 }, { 28, 56, 15 }, { 29, 56, 17 }, // + { 30, 56, 25 }, { 31, 12, 1 }, { 32, 36, 0 }, { 33, 51, 22 }, // + { 34, 51, 11 }, { 38, 38, 0 }, { 39, 24, 2 }, { 40, 50, 1 }, // + { 42, 50, 16 }, { 45, 54, 4 }, { 46, 52, 1 }, { 47, 9, 17 }, // + { 48, 48, 7 }, { 49, 49, 12 }, { 50, 41, 2 }, { 51, 51, 5 }, // + { 52, 54, 2 }, { 53, 48, 20 }, { 54, 49, 8 }, { 55, 49, 7 }, // + { 56, 55, 22 }, { 57, 30, 3 }, { 58, 48, 21 }, { 59, 50, 10 }, // + { 60, 37, 0 }, { 61, 56, 23 }, { 62, 52, 7 }, { 63, 29, 0 } }; // This is used to generate list of missing locations map_flag_check MapFlagChecklist[MAP_COUNT_MAX] = { // - { 1, 1, 9, 0 }, { 1, 2, 9, 1 }, { 1, 3, 9, 2 }, // - { 1, 4, 9, 3 }, { 1, 5, 9, 4 }, { 1, 6, 9, 5 }, // - { 1, 7, 9, 6 }, { 2, 0, 9, 7 }, { 2, 1, 9, 8 }, // - { 2, 2, 9, 9 }, { 2, 3, 9, 10 }, { 2, 4, 9, 11 }, // - { 2, 5, 9, 12 }, { 3, 0, 9, 15 }, { 3, 1, 11, 0 }, // - { 3, 2, 12, 0 }, { 3, 3, 9, 16 }, { 3, 4, 13, 0 }, // - { 3, 5, 13, 1 }, { 3, 6, 13, 2 }, { 3, 7, 13, 3 }, // - { 4, 0, 13, 4 }, { 4, 1, 13, 5 }, { 4, 2, 13, 6 }, // - { 4, 4, 13, 8 }, { 4, 5, 13, 9 }, { 4, 6, 13, 10 }, // - { 4, 7, 13, 11 }, { 5, 0, 13, 12 }, { 5, 1, 13, 13 }, // - { 5, 2, 13, 14 }, { 5, 3, 13, 15 }, { 5, 4, 13, 16 }, // - { 5, 6, 14, 0 }, { 5, 7, 15, 0 }, { 6, 0, 15, 1 }, // - { 6, 1, 15, 2 }, { 6, 2, 15, 3 }, { 6, 3, 15, 4 }, // - { 6, 4, 15, 5 }, { 6, 5, 15, 6 }, { 6, 7, 15, 8 }, // - { 7, 1, 15, 10 }, { 7, 2, 15, 11 }, { 7, 3, 15, 12 }, // - { 7, 4, 16, 0 }, { 7, 5, 17, 0 }, { 7, 7, 22, 0 }, // - { 8, 3, 22, 4 }, { 8, 5, 22, 6 }, { 8, 6, 22, 7 }, // - { 8, 7, 22, 8 }, { 9, 0, 22, 9 }, { 9, 2, 23, 1 }, // - { 9, 3, 23, 2 }, { 9, 4, 23, 3 }, { 9, 5, 23, 4 }, // - { 9, 6, 23, 5 }, { 9, 7, 24, 0 }, { 10, 0, 24, 1 }, // - { 10, 1, 24, 2 }, { 10, 2, 24, 3 }, { 10, 3, 24, 4 }, // - { 10, 4, 24, 5 }, { 10, 5, 24, 6 }, { 10, 6, 24, 7 }, // - { 10, 7, 24, 8 }, { 11, 0, 24, 9 }, { 11, 1, 24, 10 }, // - { 11, 2, 24, 11 }, { 11, 3, 24, 12 }, { 11, 4, 24, 13 }, // - { 11, 5, 24, 14 }, { 11, 6, 24, 15 }, { 11, 7, 25, 0 }, // - { 12, 0, 25, 1 }, { 12, 1, 25, 2 }, { 12, 2, 25, 3 }, // - { 12, 3, 25, 4 }, { 12, 5, 27, 0 }, { 12, 6, 27, 1 }, // - { 13, 1, 28, 0 }, { 13, 2, 28, 1 }, { 13, 3, 28, 2 }, // - { 13, 4, 28, 3 }, { 13, 5, 28, 4 }, { 13, 6, 28, 5 }, // - { 13, 7, 28, 6 }, { 14, 0, 28, 7 }, { 14, 1, 28, 8 }, // - { 14, 2, 28, 9 }, { 14, 3, 28, 10 }, { 14, 4, 28, 11 }, // - { 14, 5, 28, 12 }, { 14, 6, 28, 13 }, { 14, 7, 28, 14 }, // - { 15, 0, 28, 15 }, { 15, 1, 28, 16 }, { 15, 2, 28, 17 }, // - { 15, 3, 28, 18 }, { 15, 4, 29, 0 }, { 15, 6, 29, 2 }, // - { 15, 7, 29, 3 }, { 16, 0, 29, 4 }, { 16, 1, 29, 5 }, // - { 16, 2, 29, 6 }, { 17, 3, 30, 0 }, { 17, 4, 30, 1 }, // - { 17, 5, 30, 2 }, { 17, 6, 30, 3 }, { 17, 7, 30, 4 }, // - { 18, 0, 30, 5 }, { 18, 1, 31, 0 }, { 18, 2, 31, 1 }, // - { 18, 3, 32, 1 }, { 18, 4, 32, 1 }, { 18, 5, 32, 2 }, // - { 18, 6, 32, 3 }, { 18, 7, 32, 4 }, { 19, 0, 32, 5 }, // - { 19, 1, 32, 6 }, { 19, 2, 32, 7 }, { 19, 3, 32, 8 }, // - { 19, 4, 32, 9 }, { 19, 5, 32, 10 }, { 19, 6, 32, 11 }, // - { 19, 7, 32, 12 }, { 20, 0, 32, 13 }, { 20, 2, 32, 15 }, // - { 20, 3, 32, 16 }, { 20, 4, 32, 17 }, { 20, 5, 32, 18 }, // - { 20, 6, 32, 19 }, { 21, 3, 39, 0 }, { 21, 5, 34, 0 }, // - { 21, 6, 35, 0 }, { 21, 7, 36, 0 }, { 22, 0, 37, 0 }, // - { 22, 1, 38, 0 }, { 22, 3, 40, 0 }, { 22, 4, 40, 1 }, // - { 22, 5, 40, 2 }, { 22, 6, 40, 3 }, { 22, 7, 40, 4 }, // - { 23, 0, 40, 5 }, { 23, 1, 40, 6 }, { 23, 2, 40, 7 }, // - { 23, 3, 40, 8 }, { 23, 4, 40, 9 }, { 23, 5, 40, 10 }, // - { 23, 6, 40, 11 }, { 23, 7, 40, 12 }, { 24, 0, 40, 13 }, // - { 24, 1, 40, 14 }, { 24, 2, 40, 15 }, { 24, 3, 40, 16 }, // - { 24, 4, 40, 17 }, { 24, 5, 40, 18 }, { 24, 6, 40, 19 }, // - { 24, 7, 40, 20 }, { 25, 0, 40, 21 }, { 25, 1, 40, 22 }, // - { 25, 2, 40, 23 }, { 25, 3, 40, 24 }, { 25, 4, 40, 25 }, // - { 25, 5, 42, 0 }, { 25, 6, 43, 0 }, { 25, 7, 44, 0 }, // - { 26, 0, 45, 0 }, { 26, 1, 46, 0 }, { 26, 2, 47, 0 }, // - { 27, 4, 48, 0 }, { 27, 5, 48, 1 }, { 27, 6, 48, 2 }, // - { 27, 7, 48, 3 }, { 28, 0, 48, 4 }, { 28, 1, 48, 5 }, // - { 28, 2, 48, 6 }, { 28, 3, 48, 7 }, { 28, 4, 48, 8 }, // - { 28, 5, 48, 9 }, { 28, 6, 48, 10 }, { 28, 7, 48, 11 }, // - { 29, 0, 48, 12 }, { 29, 1, 48, 13 }, { 29, 2, 48, 14 }, // - { 29, 3, 48, 15 }, { 29, 4, 48, 16 }, { 29, 5, 48, 17 }, // - { 29, 6, 48, 18 }, { 29, 7, 48, 19 }, { 30, 0, 48, 20 }, // - { 30, 1, 48, 21 }, { 30, 2, 48, 22 }, { 30, 3, 48, 23 }, // - { 30, 4, 48, 24 }, { 30, 5, 48, 25 }, { 30, 6, 48, 26 }, // - { 30, 7, 49, 0 }, { 31, 0, 49, 1 }, { 31, 1, 49, 2 }, // - { 31, 2, 49, 3 }, { 31, 3, 49, 4 }, { 31, 4, 49, 5 }, // - { 31, 5, 49, 6 }, { 31, 6, 49, 7 }, { 31, 7, 49, 8 }, // - { 32, 0, 49, 9 }, { 32, 1, 49, 10 }, { 32, 2, 49, 11 }, // - { 32, 3, 49, 12 }, { 32, 4, 50, 0 }, { 32, 5, 50, 1 }, // - { 32, 6, 50, 2 }, { 32, 7, 50, 3 }, { 33, 0, 50, 4 }, // - { 33, 1, 50, 5 }, { 33, 2, 50, 6 }, { 33, 3, 50, 7 }, // - { 33, 4, 50, 8 }, { 33, 5, 50, 9 }, { 33, 6, 50, 10 }, // - { 33, 7, 50, 11 }, { 34, 0, 50, 12 }, { 34, 1, 50, 13 }, // - { 34, 2, 50, 14 }, { 34, 3, 50, 15 }, { 34, 4, 50, 16 }, // - { 34, 5, 50, 17 }, { 34, 6, 50, 18 }, { 34, 7, 50, 19 }, // - { 35, 0, 50, 20 }, { 35, 1, 50, 21 }, { 35, 2, 50, 22 }, // - { 35, 3, 50, 23 }, { 35, 4, 51, 0 }, { 35, 5, 51, 1 }, // - { 35, 6, 51, 2 }, { 35, 7, 51, 3 }, { 36, 0, 51, 4 }, // - { 36, 1, 51, 5 }, { 36, 2, 51, 6 }, { 36, 3, 51, 7 }, // - { 36, 4, 51, 8 }, { 36, 5, 51, 9 }, { 36, 6, 51, 10 }, // - { 36, 7, 51, 11 }, { 37, 0, 51, 12 }, { 37, 1, 51, 13 }, // - { 37, 2, 51, 14 }, { 37, 3, 51, 15 }, { 37, 4, 51, 16 }, // - { 37, 5, 51, 17 }, { 37, 6, 51, 18 }, { 37, 7, 51, 19 }, // - { 38, 0, 51, 20 }, { 38, 1, 51, 21 }, { 38, 2, 51, 22 }, // - { 38, 3, 51, 23 }, { 38, 4, 51, 24 }, { 38, 5, 51, 25 }, // - { 38, 6, 51, 26 }, { 38, 7, 53, 0 }, { 39, 0, 53, 1 }, // - { 39, 1, 53, 2 }, { 39, 2, 53, 3 }, { 39, 3, 53, 4 }, // - { 39, 4, 53, 5 }, { 39, 5, 53, 6 }, { 39, 6, 53, 7 }, // - { 39, 7, 53, 8 }, { 40, 0, 53, 9 }, { 40, 1, 53, 10 }, // - { 40, 2, 53, 11 }, { 40, 3, 53, 12 }, { 40, 4, 53, 13 }, // - { 40, 5, 53, 14 }, { 40, 6, 53, 15 }, { 40, 7, 53, 16 }, // - { 41, 0, 53, 17 }, { 41, 1, 53, 18 }, { 41, 2, 53, 19 }, // - { 41, 3, 53, 20 }, { 41, 4, 53, 21 }, { 41, 5, 53, 22 }, // - { 41, 6, 53, 23 }, { 41, 7, 53, 24 }, { 42, 0, 53, 25 }, // - { 42, 1, 53, 26 }, { 42, 2, 53, 27 }, { 42, 3, 53, 28 }, // - { 42, 4, 53, 29 }, { 42, 6, 53, 31 }, { 42, 7, 54, 0 }, // - { 43, 0, 54, 1 }, { 43, 1, 54, 2 }, { 43, 2, 54, 3 }, // - { 43, 3, 54, 4 }, { 43, 4, 41, 0 }, { 43, 5, 41, 1 }, // - { 43, 6, 41, 2 }, { 43, 7, 52, 0 }, { 44, 0, 52, 1 }, // - { 44, 1, 52, 2 }, { 44, 2, 52, 3 }, { 44, 3, 52, 4 }, // - { 44, 4, 52, 5 }, { 44, 5, 52, 6 }, { 44, 6, 52, 7 }, // - { 44, 7, 55, 0 }, { 45, 0, 55, 1 }, { 45, 1, 55, 2 }, // - { 45, 2, 55, 3 }, { 45, 3, 55, 4 }, { 45, 4, 55, 5 }, // - { 45, 5, 55, 6 }, { 45, 6, 55, 7 }, { 45, 7, 55, 8 }, // - { 46, 0, 55, 9 }, { 46, 1, 55, 10 }, { 46, 2, 55, 11 }, // - { 46, 3, 55, 12 }, { 46, 4, 55, 13 }, { 46, 5, 55, 14 }, // - { 46, 6, 55, 15 }, { 46, 7, 55, 16 }, { 47, 0, 55, 17 }, // - { 47, 1, 55, 18 }, { 47, 2, 55, 19 }, { 47, 3, 55, 20 }, // - { 47, 4, 55, 21 }, { 47, 5, 55, 22 }, { 47, 6, 56, 0 }, // - { 47, 7, 56, 1 }, { 48, 0, 56, 2 }, { 48, 1, 56, 3 }, // - { 48, 2, 56, 4 }, { 48, 3, 56, 5 }, { 48, 4, 56, 6 }, // - { 48, 5, 56, 7 }, { 48, 6, 56, 8 }, { 48, 7, 56, 9 }, // - { 49, 0, 56, 10 }, { 49, 1, 56, 11 }, { 49, 2, 56, 12 }, // - { 49, 3, 56, 13 }, { 49, 4, 56, 14 }, { 49, 5, 56, 15 }, // - { 49, 6, 56, 16 }, { 49, 7, 56, 17 }, { 50, 0, 56, 18 }, // - { 50, 1, 56, 19 }, { 50, 2, 56, 20 }, { 50, 3, 56, 21 }, // - { 50, 4, 56, 22 }, { 50, 5, 56, 23 }, { 50, 6, 56, 24 }, // - { 50, 7, 56, 25 }, { 51, 1, 9, 17 }, { 51, 2, 51, 27 }, // - { 51, 3, 51, 28 } + { 1, 1, 9, 0 }, { 1, 2, 9, 1 }, { 1, 3, 9, 2 }, // + { 1, 4, 9, 3 }, { 1, 5, 9, 4 }, { 1, 6, 9, 5 }, // + { 1, 7, 9, 6 }, { 2, 0, 9, 7 }, { 2, 1, 9, 8 }, // + { 2, 2, 9, 9 }, { 2, 3, 9, 10 }, { 2, 4, 9, 11 }, // + { 2, 5, 9, 12 }, { 3, 0, 9, 15 }, { 3, 1, 11, 0 }, // + { 3, 2, 12, 0 }, { 3, 3, 9, 16 }, { 3, 4, 13, 0 }, // + { 3, 5, 13, 1 }, { 3, 6, 13, 2 }, { 3, 7, 13, 3 }, // + { 4, 0, 13, 4 }, { 4, 1, 13, 5 }, { 4, 2, 13, 6 }, // + { 4, 4, 13, 8 }, { 4, 5, 13, 9 }, { 4, 6, 13, 10 }, // + { 4, 7, 13, 11 }, { 5, 0, 13, 12 }, { 5, 1, 13, 13 }, // + { 5, 2, 13, 14 }, { 5, 3, 13, 15 }, { 5, 4, 13, 16 }, // + { 5, 6, 14, 0 }, { 5, 7, 15, 0 }, { 6, 0, 15, 1 }, // + { 6, 1, 15, 2 }, { 6, 2, 15, 3 }, { 6, 3, 15, 4 }, // + { 6, 4, 15, 5 }, { 6, 5, 15, 6 }, { 6, 7, 15, 8 }, // + { 7, 1, 15, 10 }, { 7, 2, 15, 11 }, { 7, 3, 15, 12 }, // + { 7, 4, 16, 0 }, { 7, 5, 17, 0 }, { 7, 7, 22, 0 }, // + { 8, 3, 22, 4 }, { 8, 5, 22, 6 }, { 8, 6, 22, 7 }, // + { 8, 7, 22, 8 }, { 9, 0, 22, 9 }, { 9, 2, 23, 1 }, // + { 9, 3, 23, 2 }, { 9, 4, 23, 3 }, { 9, 5, 23, 4 }, // + { 9, 6, 23, 5 }, { 9, 7, 24, 0 }, { 10, 0, 24, 1 }, // + { 10, 1, 24, 2 }, { 10, 2, 24, 3 }, { 10, 3, 24, 4 }, // + { 10, 4, 24, 5 }, { 10, 5, 24, 6 }, { 10, 6, 24, 7 }, // + { 10, 7, 24, 8 }, { 11, 0, 24, 9 }, { 11, 1, 24, 10 }, // + { 11, 2, 24, 11 }, { 11, 3, 24, 12 }, { 11, 4, 24, 13 }, // + { 11, 5, 24, 14 }, { 11, 6, 24, 15 }, { 11, 7, 25, 0 }, // + { 12, 0, 25, 1 }, { 12, 1, 25, 2 }, { 12, 2, 25, 3 }, // + { 12, 3, 25, 4 }, { 12, 5, 27, 0 }, { 12, 6, 27, 1 }, // + { 13, 1, 28, 0 }, { 13, 2, 28, 1 }, { 13, 3, 28, 2 }, // + { 13, 4, 28, 3 }, { 13, 5, 28, 4 }, { 13, 6, 28, 5 }, // + { 13, 7, 28, 6 }, { 14, 0, 28, 7 }, { 14, 1, 28, 8 }, // + { 14, 2, 28, 9 }, { 14, 3, 28, 10 }, { 14, 4, 28, 11 }, // + { 14, 5, 28, 12 }, { 14, 6, 28, 13 }, { 14, 7, 28, 14 }, // + { 15, 0, 28, 15 }, { 15, 1, 28, 16 }, { 15, 2, 28, 17 }, // + { 15, 3, 28, 18 }, { 15, 4, 29, 0 }, { 15, 6, 29, 2 }, // + { 15, 7, 29, 3 }, { 16, 0, 29, 4 }, { 16, 1, 29, 5 }, // + { 16, 2, 29, 6 }, { 17, 3, 30, 0 }, { 17, 4, 30, 1 }, // + { 17, 5, 30, 2 }, { 17, 6, 30, 3 }, { 17, 7, 30, 4 }, // + { 18, 0, 30, 5 }, { 18, 1, 31, 0 }, { 18, 2, 31, 1 }, // + { 18, 3, 32, 1 }, { 18, 4, 32, 1 }, { 18, 5, 32, 2 }, // + { 18, 6, 32, 3 }, { 18, 7, 32, 4 }, { 19, 0, 32, 5 }, // + { 19, 1, 32, 6 }, { 19, 2, 32, 7 }, { 19, 3, 32, 8 }, // + { 19, 4, 32, 9 }, { 19, 5, 32, 10 }, { 19, 6, 32, 11 }, // + { 19, 7, 32, 12 }, { 20, 0, 32, 13 }, { 20, 2, 32, 15 }, // + { 20, 3, 32, 16 }, { 20, 4, 32, 17 }, { 20, 5, 32, 18 }, // + { 20, 6, 32, 19 }, { 21, 3, 39, 0 }, { 21, 5, 34, 0 }, // + { 21, 6, 35, 0 }, { 21, 7, 36, 0 }, { 22, 0, 37, 0 }, // + { 22, 1, 38, 0 }, { 22, 3, 40, 0 }, { 22, 4, 40, 1 }, // + { 22, 5, 40, 2 }, { 22, 6, 40, 3 }, { 22, 7, 40, 4 }, // + { 23, 0, 40, 5 }, { 23, 1, 40, 6 }, { 23, 2, 40, 7 }, // + { 23, 3, 40, 8 }, { 23, 4, 40, 9 }, { 23, 5, 40, 10 }, // + { 23, 6, 40, 11 }, { 23, 7, 40, 12 }, { 24, 0, 40, 13 }, // + { 24, 1, 40, 14 }, { 24, 2, 40, 15 }, { 24, 3, 40, 16 }, // + { 24, 4, 40, 17 }, { 24, 5, 40, 18 }, { 24, 6, 40, 19 }, // + { 24, 7, 40, 20 }, { 25, 0, 40, 21 }, { 25, 1, 40, 22 }, // + { 25, 2, 40, 23 }, { 25, 3, 40, 24 }, { 25, 4, 40, 25 }, // + { 25, 5, 42, 0 }, { 25, 6, 43, 0 }, { 25, 7, 44, 0 }, // + { 26, 0, 45, 0 }, { 26, 1, 46, 0 }, { 26, 2, 47, 0 }, // + { 27, 4, 48, 0 }, { 27, 5, 48, 1 }, { 27, 6, 48, 2 }, // + { 27, 7, 48, 3 }, { 28, 0, 48, 4 }, { 28, 1, 48, 5 }, // + { 28, 2, 48, 6 }, { 28, 3, 48, 7 }, { 28, 4, 48, 8 }, // + { 28, 5, 48, 9 }, { 28, 6, 48, 10 }, { 28, 7, 48, 11 }, // + { 29, 0, 48, 12 }, { 29, 1, 48, 13 }, { 29, 2, 48, 14 }, // + { 29, 3, 48, 15 }, { 29, 4, 48, 16 }, { 29, 5, 48, 17 }, // + { 29, 6, 48, 18 }, { 29, 7, 48, 19 }, { 30, 0, 48, 20 }, // + { 30, 1, 48, 21 }, { 30, 2, 48, 22 }, { 30, 3, 48, 23 }, // + { 30, 4, 48, 24 }, { 30, 5, 48, 25 }, { 30, 6, 48, 26 }, // + { 30, 7, 49, 0 }, { 31, 0, 49, 1 }, { 31, 1, 49, 2 }, // + { 31, 2, 49, 3 }, { 31, 3, 49, 4 }, { 31, 4, 49, 5 }, // + { 31, 5, 49, 6 }, { 31, 6, 49, 7 }, { 31, 7, 49, 8 }, // + { 32, 0, 49, 9 }, { 32, 1, 49, 10 }, { 32, 2, 49, 11 }, // + { 32, 3, 49, 12 }, { 32, 4, 50, 0 }, { 32, 5, 50, 1 }, // + { 32, 6, 50, 2 }, { 32, 7, 50, 3 }, { 33, 0, 50, 4 }, // + { 33, 1, 50, 5 }, { 33, 2, 50, 6 }, { 33, 3, 50, 7 }, // + { 33, 4, 50, 8 }, { 33, 5, 50, 9 }, { 33, 6, 50, 10 }, // + { 33, 7, 50, 11 }, { 34, 0, 50, 12 }, { 34, 1, 50, 13 }, // + { 34, 2, 50, 14 }, { 34, 3, 50, 15 }, { 34, 4, 50, 16 }, // + { 34, 5, 50, 17 }, { 34, 6, 50, 18 }, { 34, 7, 50, 19 }, // + { 35, 0, 50, 20 }, { 35, 1, 50, 21 }, { 35, 2, 50, 22 }, // + { 35, 3, 50, 23 }, { 35, 4, 51, 0 }, { 35, 5, 51, 1 }, // + { 35, 6, 51, 2 }, { 35, 7, 51, 3 }, { 36, 0, 51, 4 }, // + { 36, 1, 51, 5 }, { 36, 2, 51, 6 }, { 36, 3, 51, 7 }, // + { 36, 4, 51, 8 }, { 36, 5, 51, 9 }, { 36, 6, 51, 10 }, // + { 36, 7, 51, 11 }, { 37, 0, 51, 12 }, { 37, 1, 51, 13 }, // + { 37, 2, 51, 14 }, { 37, 3, 51, 15 }, { 37, 4, 51, 16 }, // + { 37, 5, 51, 17 }, { 37, 6, 51, 18 }, { 37, 7, 51, 19 }, // + { 38, 0, 51, 20 }, { 38, 1, 51, 21 }, { 38, 2, 51, 22 }, // + { 38, 3, 51, 23 }, { 38, 4, 51, 24 }, { 38, 5, 51, 25 }, // + { 38, 6, 51, 26 }, { 38, 7, 53, 0 }, { 39, 0, 53, 1 }, // + { 39, 1, 53, 2 }, { 39, 2, 53, 3 }, { 39, 3, 53, 4 }, // + { 39, 4, 53, 5 }, { 39, 5, 53, 6 }, { 39, 6, 53, 7 }, // + { 39, 7, 53, 8 }, { 40, 0, 53, 9 }, { 40, 1, 53, 10 }, // + { 40, 2, 53, 11 }, { 40, 3, 53, 12 }, { 40, 4, 53, 13 }, // + { 40, 5, 53, 14 }, { 40, 6, 53, 15 }, { 40, 7, 53, 16 }, // + { 41, 0, 53, 17 }, { 41, 1, 53, 18 }, { 41, 2, 53, 19 }, // + { 41, 3, 53, 20 }, { 41, 4, 53, 21 }, { 41, 5, 53, 22 }, // + { 41, 6, 53, 23 }, { 41, 7, 53, 24 }, { 42, 0, 53, 25 }, // + { 42, 1, 53, 26 }, { 42, 2, 53, 27 }, { 42, 3, 53, 28 }, // + { 42, 4, 53, 29 }, { 42, 6, 53, 31 }, { 42, 7, 54, 0 }, // + { 43, 0, 54, 1 }, { 43, 1, 54, 2 }, { 43, 2, 54, 3 }, // + { 43, 3, 54, 4 }, { 43, 4, 41, 0 }, { 43, 5, 41, 1 }, // + { 43, 6, 41, 2 }, { 43, 7, 52, 0 }, { 44, 0, 52, 1 }, // + { 44, 1, 52, 2 }, { 44, 2, 52, 3 }, { 44, 3, 52, 4 }, // + { 44, 4, 52, 5 }, { 44, 5, 52, 6 }, { 44, 6, 52, 7 }, // + { 44, 7, 55, 0 }, { 45, 0, 55, 1 }, { 45, 1, 55, 2 }, // + { 45, 2, 55, 3 }, { 45, 3, 55, 4 }, { 45, 4, 55, 5 }, // + { 45, 5, 55, 6 }, { 45, 6, 55, 7 }, { 45, 7, 55, 8 }, // + { 46, 0, 55, 9 }, { 46, 1, 55, 10 }, { 46, 2, 55, 11 }, // + { 46, 3, 55, 12 }, { 46, 4, 55, 13 }, { 46, 5, 55, 14 }, // + { 46, 6, 55, 15 }, { 46, 7, 55, 16 }, { 47, 0, 55, 17 }, // + { 47, 1, 55, 18 }, { 47, 2, 55, 19 }, { 47, 3, 55, 20 }, // + { 47, 4, 55, 21 }, { 47, 5, 55, 22 }, { 47, 6, 56, 0 }, // + { 47, 7, 56, 1 }, { 48, 0, 56, 2 }, { 48, 1, 56, 3 }, // + { 48, 2, 56, 4 }, { 48, 3, 56, 5 }, { 48, 4, 56, 6 }, // + { 48, 5, 56, 7 }, { 48, 6, 56, 8 }, { 48, 7, 56, 9 }, // + { 49, 0, 56, 10 }, { 49, 1, 56, 11 }, { 49, 2, 56, 12 }, // + { 49, 3, 56, 13 }, { 49, 4, 56, 14 }, { 49, 5, 56, 15 }, // + { 49, 6, 56, 16 }, { 49, 7, 56, 17 }, { 50, 0, 56, 18 }, // + { 50, 1, 56, 19 }, { 50, 2, 56, 20 }, { 50, 3, 56, 21 }, // + { 50, 4, 56, 22 }, { 50, 5, 56, 23 }, { 50, 6, 56, 24 }, // + { 50, 7, 56, 25 }, { 51, 1, 9, 17 }, { 51, 2, 51, 27 }, // + { 51, 3, 51, 28 } }; void -ReadKillList() -{ - usize BytesToRead = sizeof(kill_list); - usize BytesRead = ReadGameMemory( - processID, OFFSET_GAZETTE_KILL_LIST_HUMAN, BytesToRead, &KillListCur); +ReadKillList() { + usize BytesToRead = sizeof(kill_list); + usize BytesRead = ReadGameMemory( + processID, OFFSET_GAZETTE_KILL_LIST_HUMAN, BytesToRead, &KillListCur); } void -PrintKillList() -{ - sprintf_s(szBuffer, _countof(szBuffer), "\nKILL LIST:\n"); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Human: %5i\n", KillListCur.Human); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Beast: %5i\n", KillListCur.Beast); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Undead: %5i\n", KillListCur.Undead); - WriteToBackBuffer(); - sprintf_s( - szBuffer, _countof(szBuffer), "Phantom: %5i\n", KillListCur.Phantom); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Dragon: %5i\n", KillListCur.Dragon); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Evil: %5i\n", KillListCur.Evil); - WriteToBackBuffer(); +PrintKillList() { + swprintf_s(szBuffer, _countof(szBuffer), L"\nKILL LIST:\n"); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Human: %5i\n", KillListCur.Human); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Beast: %5i\n", KillListCur.Beast); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Undead: %5i\n", KillListCur.Undead); + WriteToBackBuffer(); + swprintf_s( + szBuffer, _countof(szBuffer), L"Phantom: %5i\n", KillListCur.Phantom); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Dragon: %5i\n", KillListCur.Dragon); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Evil: %5i\n", KillListCur.Evil); + WriteToBackBuffer(); } BOOL -KillListChanged() -{ - usize DataSize = sizeof(kill_list); +KillListChanged() { + usize DataSize = sizeof(kill_list); - BOOL Result = - DataChanged((void *) &KillListPrev, (void *) &KillListCur, DataSize); + BOOL Result = + DataChanged((void *) &KillListPrev, (void *) &KillListCur, DataSize); - return Result; + return Result; } void -WriteKillList() -{ - FILE *fpKillList = fopen("game_data/score/kill_list.txt", "w"); +WriteKillList() { FILE *fpKillList = _wfopen(L"game_data/score/kill_list.txt", L"w"); - fprintf(fpKillList, "== KILL LIST ==\n\n"); - fprintf(fpKillList, "Human: %5i\n", KillListCur.Human); - fprintf(fpKillList, "Beast: %5i\n", KillListCur.Beast); - fprintf(fpKillList, "Undead: %5i\n", KillListCur.Undead); - fprintf(fpKillList, "Phantom: %5i\n", KillListCur.Phantom); - fprintf(fpKillList, "Dragon: %5i\n", KillListCur.Dragon); - fprintf(fpKillList, "Evil: %5i\n", KillListCur.Evil); + fwprintf(fpKillList, L"== KILL LIST ==\n\n"); + fwprintf(fpKillList, L"Human: %5i\n", KillListCur.Human); + fwprintf(fpKillList, L"Beast: %5i\n", KillListCur.Beast); + fwprintf(fpKillList, L"Undead: %5i\n", KillListCur.Undead); + fwprintf(fpKillList, L"Phantom: %5i\n", KillListCur.Phantom); + fwprintf(fpKillList, L"Dragon: %5i\n", KillListCur.Dragon); + fwprintf(fpKillList, L"Evil: %5i\n", KillListCur.Evil); - fclose(fpKillList); + fclose(fpKillList); } void -ReadWeaponUsage() -{ - usize BytesToRead = sizeof(weapon_usage); - usize BytesRead = ReadGameMemory(processID, - OFFSET_GAZETTE_WEAPON_USAGE_UNARMED, BytesToRead, &WeaponUsageCur); +ReadWeaponUsage() { + usize BytesToRead = sizeof(weapon_usage); + usize BytesRead = ReadGameMemory(processID, + OFFSET_GAZETTE_WEAPON_USAGE_UNARMED, BytesToRead, &WeaponUsageCur); } void -PrintWeaponUsage() -{ - sprintf_s(szBuffer, _countof(szBuffer), "\nWEAPON USAGE:\n"); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Dagger: %5i\n", - WeaponUsageCur.Dagger); - WriteToBackBuffer(); - sprintf_s( - szBuffer, _countof(szBuffer), "Sword: %5i\n", WeaponUsageCur.Sword); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Great Sword: %5i\n", - WeaponUsageCur.GreatSword); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Axe/Mace: %5i\n", - WeaponUsageCur.AxeMace); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Great Axe: %5i\n", - WeaponUsageCur.GreatAxe); - WriteToBackBuffer(); - sprintf_s( - szBuffer, _countof(szBuffer), "Staff: %5i\n", WeaponUsageCur.Staff); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Heavy Mace: %5i\n", - WeaponUsageCur.HeavyMace); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Polearm: %5i\n", - WeaponUsageCur.Polearm); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Crossbow: %5i\n", - WeaponUsageCur.Crossbow); - WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "Unarmed: %5i\n", - WeaponUsageCur.Unarmed); - WriteToBackBuffer(); +PrintWeaponUsage() { + swprintf_s(szBuffer, _countof(szBuffer), L"\nWEAPON USAGE:\n"); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Dagger: %5i\n", + WeaponUsageCur.Dagger); + WriteToBackBuffer(); + swprintf_s( + szBuffer, _countof(szBuffer), L"Sword: %5i\n", WeaponUsageCur.Sword); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Great Sword: %5i\n", + WeaponUsageCur.GreatSword); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Axe/Mace: %5i\n", + WeaponUsageCur.AxeMace); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Great Axe: %5i\n", + WeaponUsageCur.GreatAxe); + WriteToBackBuffer(); + swprintf_s( + szBuffer, _countof(szBuffer), L"Staff: %5i\n", WeaponUsageCur.Staff); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Heavy Mace: %5i\n", + WeaponUsageCur.HeavyMace); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Polearm: %5i\n", + WeaponUsageCur.Polearm); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Crossbow: %5i\n", + WeaponUsageCur.Crossbow); + WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Unarmed: %5i\n", + WeaponUsageCur.Unarmed); + WriteToBackBuffer(); } void -WriteWeaponUsage() -{ - FILE *fpWeaponUsage = fopen("game_data/score/weapon_usage.txt", "w"); - - fprintf(fpWeaponUsage, "== WEAPON USAGE ==\n\n"); - fprintf(fpWeaponUsage, "Dagger: %5i\n", WeaponUsageCur.Dagger); - fprintf(fpWeaponUsage, "Sword: %5i\n", WeaponUsageCur.Sword); - fprintf(fpWeaponUsage, "Great Sword: %5i\n", WeaponUsageCur.GreatSword); - fprintf(fpWeaponUsage, "Axe/Mace: %5i\n", WeaponUsageCur.AxeMace); - fprintf(fpWeaponUsage, "Great Axe: %5i\n", WeaponUsageCur.GreatAxe); - fprintf(fpWeaponUsage, "Staff: %5i\n", WeaponUsageCur.Staff); - fprintf(fpWeaponUsage, "Heavy Mace: %5i\n", WeaponUsageCur.HeavyMace); - fprintf(fpWeaponUsage, "Polearm: %5i\n", WeaponUsageCur.Polearm); - fprintf(fpWeaponUsage, "Crossbow: %5i\n", WeaponUsageCur.Crossbow); - fprintf(fpWeaponUsage, "Unarmed: %5i\n", WeaponUsageCur.Unarmed); - - fclose(fpWeaponUsage); +WriteWeaponUsage() { + FILE *fpWeaponUsage = _wfopen(L"game_data/score/weapon_usage.txt", L"w"); + + fwprintf(fpWeaponUsage, L"== WEAPON USAGE ==\n\n"); + fwprintf(fpWeaponUsage, L"Dagger: %5i\n", WeaponUsageCur.Dagger); + fwprintf(fpWeaponUsage, L"Sword: %5i\n", WeaponUsageCur.Sword); + fwprintf(fpWeaponUsage, L"Great Sword: %5i\n", WeaponUsageCur.GreatSword); + fwprintf(fpWeaponUsage, L"Axe/Mace: %5i\n", WeaponUsageCur.AxeMace); + fwprintf(fpWeaponUsage, L"Great Axe: %5i\n", WeaponUsageCur.GreatAxe); + fwprintf(fpWeaponUsage, L"Staff: %5i\n", WeaponUsageCur.Staff); + fwprintf(fpWeaponUsage, L"Heavy Mace: %5i\n", WeaponUsageCur.HeavyMace); + fwprintf(fpWeaponUsage, L"Polearm: %5i\n", WeaponUsageCur.Polearm); + fwprintf(fpWeaponUsage, L"Crossbow: %5i\n", WeaponUsageCur.Crossbow); + fwprintf(fpWeaponUsage, L"Unarmed: %5i\n", WeaponUsageCur.Unarmed); + + fclose(fpWeaponUsage); } BOOL -WeaponUsageChanged() -{ - usize DataSize = sizeof(weapon_usage); +WeaponUsageChanged() { + usize DataSize = sizeof(weapon_usage); - BOOL Result = DataChanged( - (void *) &WeaponUsagePrev, (void *) &WeaponUsageCur, DataSize); + BOOL Result = DataChanged( + (void *) &WeaponUsagePrev, (void *) &WeaponUsageCur, DataSize); - return Result; + return Result; } void -ReadChestFlags(chest_flag_mem *ChestFlags) -{ - usize BytesToRead = sizeof(chest_flag_mem); +ReadChestFlags(chest_flag_mem *ChestFlags) { + usize BytesToRead = sizeof(chest_flag_mem); - usize BytesRead = ReadGameMemory( - processID, OFFSET_GAZETTE_CHEST_COUNT_FLAGS, BytesToRead, ChestFlags); + usize BytesRead = ReadGameMemory( + processID, OFFSET_GAZETTE_CHEST_COUNT_FLAGS, BytesToRead, ChestFlags); } void -CalculateChestCount(u8 *ChestCount, chest_flag_mem *ChestFlags) -{ - *ChestCount = 0; // Clear the counter +CalculateChestCount(u8 *ChestCount, chest_flag_mem *ChestFlags) { + *ChestCount = 0; // Clear the counter - for (int i = 0; i < CHEST_COUNT_FLAGS; ++i) - { - if (ChestFlags->Flags[i] == 0x01) - { - *ChestCount += 1; + for (int i = 0; i < CHEST_COUNT_FLAGS; ++i) { + if (ChestFlags->Flags[i] == 0x01) { + *ChestCount += 1; + } } - } } void WriteMissingChestList(chest_flag_mem *ChestFlags, - chest_flag_check ChestFlagChecklist[CHEST_COUNT_MAX]) -{ - location Location = { 0 }; - char ZoneName[MAX_PATH]; - char MapName[MAX_PATH]; + chest_flag_check ChestFlagChecklist[CHEST_COUNT_MAX]) { + location Location = { 0 }; + wchar_t ZoneName[MAX_PATH]; + wchar_t MapName[MAX_PATH]; - FILE *fpChestMissing = fopen("game_data/map/chest_missing.txt", "w"); + FILE *fpChestMissing = _wfopen(L"game_data/map/chest_missing.txt", L"w"); - if (ChestCount == CHEST_COUNT_MAX) - { - fprintf(fpChestMissing, "You've got them all. Nice!\n"); + if (ChestCount == CHEST_COUNT_MAX) { + fwprintf(fpChestMissing, L"You've got them all. Nice!\n"); - fclose(fpChestMissing); + fclose(fpChestMissing); - return; - } - else - { - fprintf(fpChestMissing, "Missing Treasure Chests\n\n"); + return; + } else { + fwprintf(fpChestMissing, L"Missing Treasure Chests\n\n"); - for (int i = 0; i < CHEST_COUNT_MAX; ++i) - { - if (ChestFlags->Flags[ChestFlagChecklist[i].FlagByte] == 0) - { - Location.ZoneNumber = ChestFlagChecklist[i].Zone; - Location.MapNumber = ChestFlagChecklist[i].Map; + for (int i = 0; i < CHEST_COUNT_MAX; ++i) { + if (ChestFlags->Flags[ChestFlagChecklist[i].FlagByte] == 0) { + Location.ZoneNumber = ChestFlagChecklist[i].Zone; + Location.MapNumber = ChestFlagChecklist[i].Map; - ReadZoneAndMapName(&Location, ZoneName, MapName); + ReadZoneAndMapName(&Location, ZoneName, MapName); - fprintf(fpChestMissing, "%s, %s\n", ZoneName, MapName); - } + fwprintf(fpChestMissing, L"%s, %s\n", ZoneName, MapName); + } + } } - } - fclose(fpChestMissing); + fclose(fpChestMissing); } void -ReadMapFlags(map_flag_mem *MapFlags) -{ - usize BytesToRead = sizeof(map_flag_mem); +ReadMapFlags(map_flag_mem *MapFlags) { + usize BytesToRead = sizeof(map_flag_mem); - usize BytesRead = ReadGameMemory( - processID, OFFSET_GAZETTE_MAP_COUNT_FLAGS, BytesToRead, MapFlags); + usize BytesRead = ReadGameMemory( + processID, OFFSET_GAZETTE_MAP_COUNT_FLAGS, BytesToRead, MapFlags); } void -ReadMapCheckFlags(map_flag_mem *MapCheckFlags) -{ - usize BytesToRead = sizeof(map_flag_mem); +ReadMapCheckFlags(map_flag_mem *MapCheckFlags) { + usize BytesToRead = sizeof(map_flag_mem); - usize BytesRead = ReadGameMemory(processID, - OFFSET_GAZETTE_MAP_COUNT_CHECK_FLAGS, BytesToRead, MapCheckFlags); + usize BytesRead = ReadGameMemory(processID, + OFFSET_GAZETTE_MAP_COUNT_CHECK_FLAGS, BytesToRead, MapCheckFlags); } -void + void WriteMapFlagsDiffs() { - FILE *fpMapFlagsDiff = fopen("debug/map_flag_diff.txt", "a"); - - u8 FlagPrev, FlagCur, FlagDiff, BitMask; - - for (int i = 0; i < MAP_COUNT_FLAGS; ++i) - { - FlagPrev = MapFlagMemPrev.Flags[i]; - FlagCur = MapFlagMemCur.Flags[i]; - - if (FlagPrev != FlagCur) - { - FlagDiff = FlagCur - FlagPrev; - - for (int j = 0; j < 8; ++j) - { - BitMask = 0x1 << j; - if (BitMask & FlagDiff) - { - fprintf(fpMapFlagsDiff, "%i,%i,", i, j); - fprintf(fpMapFlagsDiff, "%s,%s,%i,%i\n", nameZone, nameMap, - LocationCur.ZoneNumber, LocationCur.MapNumber); + FILE *fpMapFlagsDiff = _wfopen(L"debug/map_flag_diff.txt", L"a"); + + u8 FlagPrev, FlagCur, FlagDiff, BitMask; + + for (int i = 0; i < MAP_COUNT_FLAGS; ++i) { + FlagPrev = MapFlagMemPrev.Flags[i]; + FlagCur = MapFlagMemCur.Flags[i]; + + if (FlagPrev != FlagCur) { + FlagDiff = FlagCur - FlagPrev; + + for (int j = 0; j < 8; ++j) { + BitMask = 0x1 << j; + if (BitMask & FlagDiff) { + fwprintf(fpMapFlagsDiff, L"%i,%i,", i, j); + fwprintf(fpMapFlagsDiff, L"%s,%s,%i,%i\n", nameZone, nameMap, + LocationCur.ZoneNumber, LocationCur.MapNumber); + } + } } - } } - } - fclose(fpMapFlagsDiff); + fclose(fpMapFlagsDiff); } void -WriteChestFlagsDiffs() -{ - FILE *fpChestFlagsDiff = fopen("debug/chest_flag_diff.txt", "a"); +WriteChestFlagsDiffs() { + FILE *fpChestFlagsDiff = _wfopen(L"debug/chest_flag_diff.txt", L"a"); - u8 FlagPrev, FlagCur; + u8 FlagPrev, FlagCur; - for (int i = 0; i < CHEST_COUNT_FLAGS; ++i) - { - FlagPrev = ChestFlagMemPrev.Flags[i]; - FlagCur = ChestFlagMemCur.Flags[i]; + for (int i = 0; i < CHEST_COUNT_FLAGS; ++i) { + FlagPrev = ChestFlagMemPrev.Flags[i]; + FlagCur = ChestFlagMemCur.Flags[i]; - if (FlagPrev != FlagCur) - { - fprintf(fpChestFlagsDiff, "%i,", i); - fprintf(fpChestFlagsDiff, "%s,%s,%i,%i\n", nameZone, nameMap, - LocationCur.ZoneNumber, LocationCur.MapNumber); + if (FlagPrev != FlagCur) { + fwprintf(fpChestFlagsDiff, L"%i,", i); + fwprintf(fpChestFlagsDiff, L"%s,%s,%i,%i\n", nameZone, nameMap, + LocationCur.ZoneNumber, LocationCur.MapNumber); + } } - } - fclose(fpChestFlagsDiff); + fclose(fpChestFlagsDiff); } BOOL -MapFlagsChanged() -{ - usize DataSize = sizeof(map_flag_mem); +MapFlagsChanged() { + usize DataSize = sizeof(map_flag_mem); - BOOL Result = DataChanged( - (void *) &ChestFlagMemPrev, (void *) &ChestFlagMemCur, DataSize); + BOOL Result = DataChanged( + (void *) &ChestFlagMemPrev, (void *) &ChestFlagMemCur, DataSize); - return Result; + return Result; } BOOL -ChestFlagsChanged() -{ - usize DataSize = sizeof(chest_flag_mem); +ChestFlagsChanged() { + usize DataSize = sizeof(chest_flag_mem); - BOOL Result = DataChanged( - (void *) &ChestFlagMemPrev, (void *) &ChestFlagMemCur, DataSize); + BOOL Result = DataChanged( + (void *) &ChestFlagMemPrev, (void *) &ChestFlagMemCur, DataSize); - return Result; + return Result; } void -CalculateMapCount(u16 *MapCount) -{ - // Clear the counter - *MapCount = 0; - u8 BitMask = 0; - u8 CheckByte, FlagByte, AndByte; +CalculateMapCount(u16 *MapCount) { + // Clear the counter + *MapCount = 0; + u8 BitMask = 0; + u8 CheckByte, FlagByte, AndByte; - for (int i = 0; i < MAP_COUNT_FLAGS; ++i) - { + for (int i = 0; i < MAP_COUNT_FLAGS; ++i) { - FlagByte = MapFlagMemCur.Flags[i]; - CheckByte = MapCheckFlagMem.Flags[i]; + FlagByte = MapFlagMemCur.Flags[i]; + CheckByte = MapCheckFlagMem.Flags[i]; - AndByte = FlagByte & CheckByte; + AndByte = FlagByte & CheckByte; - for (int j = 0; j < 8; ++j) - { - BitMask = 1 << j; + for (int j = 0; j < 8; ++j) { + BitMask = 1 << j; - if (BitMask & AndByte) - { - *MapCount += 1; - } + if (BitMask & AndByte) { + *MapCount += 1; + } + } } - } } void -GenerateMapCheckFlagList() -{ - u8 BitMask = 0; - u8 CheckByte; +GenerateMapCheckFlagList() { + u8 BitMask = 0; + u8 CheckByte; - FILE *fpCheckFlags = fopen("debug/map/check_flags.txt", "w"); + FILE *fpCheckFlags = _wfopen(L"debug/map/check_flags.txt", L"w"); - for (int i = 0; i < MAP_COUNT_FLAGS; ++i) - { - CheckByte = MapCheckFlagMem.Flags[i]; + for (int i = 0; i < MAP_COUNT_FLAGS; ++i) { + CheckByte = MapCheckFlagMem.Flags[i]; - for (int j = 0; j < 8; ++j) - { - BitMask = 1 << j; + for (int j = 0; j < 8; ++j) { + BitMask = 1 << j; - if (BitMask & CheckByte) - { - fprintf(fpCheckFlags, "%i,%i\n", i, j); - } + if (BitMask & CheckByte) { + fwprintf(fpCheckFlags, L"%i,%i\n", i, j); + } + } } - } - fclose(fpCheckFlags); + fclose(fpCheckFlags); } void WriteMissingMapList( - map_flag_mem *MapFlags, map_flag_check MapFlagChecklist[MAP_COUNT_MAX]) -{ - location Location = { 0 }; - char nameZone[MAX_PATH]; - char nameMap[MAX_PATH]; - u8 FlagBitmask = 0; - u8 CurrentByte; + map_flag_mem *MapFlags, map_flag_check MapFlagChecklist[MAP_COUNT_MAX]) { + location Location = { 0 }; + wchar_t nameZone[MAX_PATH]; + wchar_t nameMap[MAX_PATH]; + u8 FlagBitmask = 0; + u8 CurrentByte; - FILE *fpMapMissing = fopen("game_data/map/room_missing.txt", "w"); + FILE *fpMapMissing = _wfopen(L"game_data/map/room_missing.txt", L"w"); - if (MapCount == MAP_COUNT_MAX) - { - fprintf(fpMapMissing, "You've been everywhere. You've seen everything.\n"); + if (MapCount == MAP_COUNT_MAX) { + fwprintf(fpMapMissing, L"You've been everywhere. You've seen everything.\n"); - fclose(fpMapMissing); + fclose(fpMapMissing); - return; - } - else - { - fprintf(fpMapMissing, "Missing Locations\n\n"); + return; + } else { + fwprintf(fpMapMissing, L"Missing Locations\n\n"); - for (int i = 0; i < MAP_COUNT_MAX; ++i) - { - CurrentByte = MapFlags->Flags[MapFlagChecklist[i].MaskByte]; - FlagBitmask = 1 << MapFlagChecklist[i].MaskBit; + for (int i = 0; i < MAP_COUNT_MAX; ++i) { + CurrentByte = MapFlags->Flags[MapFlagChecklist[i].MaskByte]; + FlagBitmask = 1 << MapFlagChecklist[i].MaskBit; - if ((CurrentByte & FlagBitmask) == 0) - { - Location.ZoneNumber = MapFlagChecklist[i].Zone; - Location.MapNumber = MapFlagChecklist[i].Map; + if ((CurrentByte & FlagBitmask) == 0) { + Location.ZoneNumber = MapFlagChecklist[i].Zone; + Location.MapNumber = MapFlagChecklist[i].Map; - ReadZoneAndMapNameCustom(&Location, nameZone, nameMap); + ReadZoneAndMapNameCustom(&Location, nameZone, nameMap); - fprintf(fpMapMissing, "%s, %s\n", nameZone, nameMap); - } + fwprintf(fpMapMissing, L"%s, %s\n", nameZone, nameMap); + } + } } - } - fclose(fpMapMissing); + fclose(fpMapMissing); } void -PrintChestCount(u8 *ChestCount) -{ - u16 ChestCountScore = (*ChestCount * 100) / CHEST_COUNT_MAX; - sprintf_s(szBuffer, _countof(szBuffer), "\nCHEST COUNT:\n"); - WriteToBackBuffer(); - - sprintf_s(szBuffer, _countof(szBuffer), "%i/%i ( %i%% )\n", *ChestCount, - CHEST_COUNT_MAX, ChestCountScore); - WriteToBackBuffer(); +PrintChestCount(u8 *ChestCount) { + u16 ChestCountScore = (*ChestCount * 100) / CHEST_COUNT_MAX; + swprintf_s(szBuffer, _countof(szBuffer), L"\nCHEST COUNT:\n"); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), L"%i/%i ( %i%% )\n", *ChestCount, + CHEST_COUNT_MAX, ChestCountScore); + WriteToBackBuffer(); } void -WriteChestCount(u8 *ChestCount) -{ - u16 ChestCountScore = (*ChestCount * 100) / CHEST_COUNT_MAX; +WriteChestCount(u8 *ChestCount) { + u16 ChestCountScore = (*ChestCount * 100) / CHEST_COUNT_MAX; - FILE *fpChestCount = fopen("game_data/map/chest_count.txt", "w"); + FILE *fpChestCount = _wfopen(L"game_data/map/chest_count.txt", L"w"); - fprintf(fpChestCount, "== CHEST COUNT ==\n\n"); + fwprintf(fpChestCount, L"== CHEST COUNT ==\n\n"); - fprintf(fpChestCount, "%i/%i ( %i%% )\n", *ChestCount, CHEST_COUNT_MAX, - ChestCountScore); + fwprintf(fpChestCount, L"%i/%i ( %i%% )\n", *ChestCount, CHEST_COUNT_MAX, + ChestCountScore); - fclose(fpChestCount); + fclose(fpChestCount); } void -PrintMapCount(u16 *MapCount) -{ - u16 MapCountScore = (*MapCount * 100) / MAP_COUNT_MAX; - sprintf_s(szBuffer, _countof(szBuffer), "\nROOM COUNT:\n"); - WriteToBackBuffer(); - - sprintf_s(szBuffer, _countof(szBuffer), "%i/%i ( %i%% )\n", *MapCount, - MAP_COUNT_MAX, MapCountScore); - WriteToBackBuffer(); +PrintMapCount(u16 *MapCount) { + u16 MapCountScore = (*MapCount * 100) / MAP_COUNT_MAX; + swprintf_s(szBuffer, _countof(szBuffer), L"\nROOM COUNT:\n"); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), L"%i/%i ( %i%% )\n", *MapCount, + MAP_COUNT_MAX, MapCountScore); + WriteToBackBuffer(); } void -WriteMapCount(u16 *MapCount) -{ - u16 MapCountScore = (*MapCount * 100) / MAP_COUNT_MAX; +WriteMapCount(u16 *MapCount) { + u16 MapCountScore = (*MapCount * 100) / MAP_COUNT_MAX; - FILE *fpMapCount = fopen("game_data/map/room_count.txt", "w"); + FILE *fpMapCount = _wfopen(L"game_data/map/room_count.txt", L"w"); - fprintf(fpMapCount, "== ROOM COUNT ==\n\n"); + fwprintf(fpMapCount, L"== ROOM COUNT ==\n\n"); - fprintf( - fpMapCount, "%i/%i ( %i%% )\n", *MapCount, MAP_COUNT_MAX, MapCountScore); + fwprintf( + fpMapCount, L"%i/%i ( %i%% )\n", *MapCount, MAP_COUNT_MAX, MapCountScore); - fclose(fpMapCount); + fclose(fpMapCount); } #endif + diff --git a/includes/vst_init.h b/includes/vst_init.h index 974cf26..4480165 100644 --- a/includes/vst_init.h +++ b/includes/vst_init.h @@ -9,14 +9,14 @@ u32 processVersion; u64 processBaseAddress; u64 emuBaseAddress; u8 emuBaseMaxAttempts; -const u8 EMU_BASE_MAGIC_STRING[] = - "\x03\x00\x00\x00\x80\x0c\x5a\x27\x08\x00\x40\x03\x00\x00\x00"; -char szModuleName[MAX_PATH]; -char szExeName[MAX_PATH]; +// 16-bytes hex: 0x03000000800c5a270800400300000000 +const u8 EMU_BASE_MAGIC_STRING[] = "\x03\x00\x00\x00\x80\x0c\x5a\x27\x08\x00\x40\x03\x00\x00\x00\x00"; -// In-game data +wchar_t szModuleName[MAX_PATH]; +wchar_t szExeName[MAX_PATH]; +// In-game data u16 GameStatus; // Time @@ -25,10 +25,13 @@ game_time GameTimePrev = { -1 }; game_time GameTimeRecord = { -1 }; // Equipment -#define WEAPON_NAME_LENGTH 18 +#define WEAPON_NAME_HEX_LENGTH 24 +#define WEAPON_NAME_UNICODE_LENGTH 50 + +wchar_t NameBuffer[MAX_PATH]; -char nameWeaponCur[WEAPON_NAME_LENGTH]; -char nameWeaponPrev[WEAPON_NAME_LENGTH]; +wchar_t nameWeaponCur[WEAPON_NAME_UNICODE_LENGTH]; +wchar_t nameWeaponPrev[WEAPON_NAME_UNICODE_LENGTH]; usize WeaponNumber = 0; @@ -90,8 +93,9 @@ status_effects effectsPlayerPrev; location LocationCur; location LocationPrev; -char nameZone[MAX_PATH]; -char nameMap[MAX_PATH]; +#define LOCATION_MAX_NAME_LENGTH 64 +wchar_t nameZone[LOCATION_MAX_NAME_LENGTH]; +wchar_t nameMap[LOCATION_MAX_NAME_LENGTH]; // Gazette map_flag_mem MapFlagMemCur; @@ -125,7 +129,8 @@ u16 ControllerInputPrev; buttons_timers ButtonsTimers; // Actors in the room -#define ACTOR_NAME_LENGTH 20 -char ActorName[ACTOR_NAME_LENGTH]; +#define ACTOR_NAME_HEX_LENGTH 24 +#define ACTOR_NAME_UNICODE_LENGTH 50 +wchar_t ActorName[ACTOR_NAME_UNICODE_LENGTH]; #endif diff --git a/includes/vst_input.h b/includes/vst_input.h index 6cd4cd3..3fdb31e 100644 --- a/includes/vst_input.h +++ b/includes/vst_input.h @@ -22,122 +22,109 @@ #define MASK_CONTROLLER_INPUT_DOWN 0x4000 #define MASK_CONTROLLER_INPUT_LEFT 0x8000 -char *ControllerInputNames[16] = { // - "L2", // - "R2", // - "L1", // - "R1", // - "Triangle", // - "Circle", // - "Cross", // - "Square", // - "Select", // - "L3", // - "R3", // - "Start", // - "Up", // - "Right", // - "Down", // - "Left" +wchar_t *ControllerInputNames[16] = { // + L"L2", // + L"R2", // + L"L1", // + L"R1", // + L"Triangle", // + L"Circle", // + L"Cross", // + L"Square", // + L"Select", // + L"L3", // + L"R3", // + L"Start", // + L"Up", // + L"Right", // + L"Down", // + L"Left" }; u16 ControllerInputMasks[16] = { // - MASK_CONTROLLER_INPUT_L2, // - MASK_CONTROLLER_INPUT_R2, // - MASK_CONTROLLER_INPUT_L1, // - MASK_CONTROLLER_INPUT_R1, // - MASK_CONTROLLER_INPUT_TRIANGLE, // - MASK_CONTROLLER_INPUT_CIRCLE, // - MASK_CONTROLLER_INPUT_CROSS, // - MASK_CONTROLLER_INPUT_SQUARE, // - MASK_CONTROLLER_INPUT_SELECT, // - MASK_CONTROLLER_INPUT_L3, // - MASK_CONTROLLER_INPUT_R3, // - MASK_CONTROLLER_INPUT_START, - MASK_CONTROLLER_INPUT_UP, // - MASK_CONTROLLER_INPUT_RIGHT, - MASK_CONTROLLER_INPUT_DOWN, // - MASK_CONTROLLER_INPUT_LEFT + MASK_CONTROLLER_INPUT_L2, // + MASK_CONTROLLER_INPUT_R2, // + MASK_CONTROLLER_INPUT_L1, // + MASK_CONTROLLER_INPUT_R1, // + MASK_CONTROLLER_INPUT_TRIANGLE, // + MASK_CONTROLLER_INPUT_CIRCLE, // + MASK_CONTROLLER_INPUT_CROSS, // + MASK_CONTROLLER_INPUT_SQUARE, // + MASK_CONTROLLER_INPUT_SELECT, // + MASK_CONTROLLER_INPUT_L3, // + MASK_CONTROLLER_INPUT_R3, // + MASK_CONTROLLER_INPUT_START, + MASK_CONTROLLER_INPUT_UP, // + MASK_CONTROLLER_INPUT_RIGHT, + MASK_CONTROLLER_INPUT_DOWN, // + MASK_CONTROLLER_INPUT_LEFT }; void -ReadControllerInput(u16 *ControllerInput) -{ - usize BytesToRead = sizeof(u16); +ReadControllerInput(u16 *ControllerInput) { + usize BytesToRead = sizeof(u16); - ReadGameMemory( - processID, OFFSET_CONTROLLER_INPUT, BytesToRead, ControllerInput); + ReadGameMemory( + processID, OFFSET_CONTROLLER_INPUT, BytesToRead, ControllerInput); } void -ReadButtonsTimers(buttons_timers *ButtonsTimers) -{ - usize BytesToRead = sizeof(buttons_timers); +ReadButtonsTimers(buttons_timers *ButtonsTimers) { + usize BytesToRead = sizeof(buttons_timers); - ReadGameMemory(processID, OFFSET_BUTTONS_TIMERS, BytesToRead, ButtonsTimers); + ReadGameMemory(processID, OFFSET_BUTTONS_TIMERS, BytesToRead, ButtonsTimers); } void -PrintControllerInput(u16 *ControllerInput) -{ - u16 Input = *ControllerInput; +PrintControllerInput(u16 *ControllerInput) { + u16 Input = *ControllerInput; - sprintf(szBuffer, "\nCONTROLLER INPUT:\n"); - WriteToBackBuffer(); - - if (!Input) // if the register is empty, skip to the end - { - sprintf(szBuffer, "None\n"); + swprintf_s(szBuffer, _countof(szBuffer), L"\nCONTROLLER INPUT:\n"); WriteToBackBuffer(); - } - else - { - for (int i = 0; i < 16; ++i) - { - if (ControllerInputMasks[i] & Input) - { - sprintf(szBuffer, "%s(%d) ", ControllerInputNames[i], - ButtonsTimers.Timers[i]); + + if (!Input) { // if the register is empty, skip to the end + swprintf_s(szBuffer, _countof(szBuffer), L"None\n"); + WriteToBackBuffer(); + } else { + for (int i = 0; i < 16; ++i) { + if (ControllerInputMasks[i] & Input) { + swprintf_s(szBuffer, _countof(szBuffer), L"%s(%d) ", ControllerInputNames[i], + ButtonsTimers.Timers[i]); + WriteToBackBuffer(); + } + } + swprintf_s(szBuffer, _countof(szBuffer), L"\n"); WriteToBackBuffer(); - } } - sprintf(szBuffer, "\n"); - WriteToBackBuffer(); - } } void -WriteControllerInput(u16 *ControllerInput) -{ - FILE *fpControllerInput = fopen("game_data/player/controller_input.txt", "w"); - u16 Input = *ControllerInput; - - if (!Input) // if the register is empty, skip to the end - { - fprintf(fpControllerInput, "No controller input\n"); - } - else - { - for (int i = 0; i < 16; ++i) +WriteControllerInput(u16 *ControllerInput) { + FILE *fpControllerInput = _wfopen(L"game_data/player/controller_input.txt", L"w"); + u16 Input = *ControllerInput; + + if (!Input) // if the register is empty, skip to the end { - if (ControllerInputMasks[i] & Input) - { - fprintf(fpControllerInput, "%s ", ControllerInputNames[i]); - } + fwprintf(fpControllerInput, L"No controller input\n"); + } else { + for (int i = 0; i < 16; ++i) { + if (ControllerInputMasks[i] & Input) { + fwprintf(fpControllerInput, L"%s ", ControllerInputNames[i]); + } + } + fwprintf(fpControllerInput, L"\n"); } - fprintf(fpControllerInput, "\n"); - } - fclose(fpControllerInput); + fclose(fpControllerInput); } BOOL -ControllerInputChanged() -{ - usize DataSize = sizeof(u16); +ControllerInputChanged() { + usize DataSize = sizeof(u16); - BOOL Result = DataChanged( - (void *) &ControllerInputPrev, (void *) &ControllerInputCur, DataSize); + BOOL Result = DataChanged( + (void *) &ControllerInputPrev, (void *) &ControllerInputCur, DataSize); - return Result; + return Result; } #endif + diff --git a/includes/vst_location.h b/includes/vst_location.h index a2a1dee..5c6a298 100644 --- a/includes/vst_location.h +++ b/includes/vst_location.h @@ -8,580 +8,568 @@ #define OFFSET_LOCATION_AREA_NUMBER 0x0f1ab0 #define OFFSET_LOCATION_ROOM_NUMBER 0x0f1ab1 -typedef struct -{ - u8 ZoneNumber; - u8 MapNumber; - char *ZoneName; - char *MapName; +typedef struct { + u8 ZoneNumber; + u8 MapNumber; + wchar_t *ZoneName; + wchar_t *MapName; } map_data; map_data MapDataList[] = { - // Loading screen - { 0, 0, "In the void", "Nothing to see here..." }, // - - // Intro 1 - { 1, 0, "Intro", "Guildenstern talks with the knight" }, // - { 2, 0, "Intro", "Ashley at the gate" }, // - { 3, 0, "Intro", "Ashley at the courtyard" }, // - { 4, 0, "Intro", "Ashley in the hall" }, // - { 5, 0, "Intro", "Ashley meets Sydney" }, // - { 6, 0, "Intro", "Ashley fights Wyvern" }, // - { 7, 0, "Intro", "Ashley walks to the window" }, // - { 8, 0, "Intro", "Ashley stares through the window" }, // - { 18, 0, "Intro", "Bardorba and Rosencrantz in Graylands Manor" }, // - { 33, 0, "Intro", "Merlose finds corpses at Lea Monde's entrance" }, // - { 10, 0, "Intro", "Ashley and Merlose at the tunnel entrance" }, // - { 9, 14, "Intro", "Ashley and Merlose at the Wine Cellar gate" }, // - - // Intro 2 - { 20, 0, "Intro", "VKP briefing" }, // - { 21, 0, "Intro", "Ashley meets Merlose outside manor" }, // - - // Outro - { 60, 0, "Epilogue", "Merlose, Hardin, and Joshua fleeing the city" }, // - { 61, 0, "Epilogue", "Pigmen crushed by the falling debris" }, // - { 62, 0, "Epilogue", "Tieger and Neesa stopped by Grissom" }, // - { 63, 0, "Epilogue", "Ashley carries Sydney" }, // - { 64, 0, "Epilogue", "Creatures of the dark vanish" }, // - { 65, 0, "Epilogue", "The Well explodes" }, // - { 66, 0, "Epilogue", "Hardin dies" }, // - { 67, 0, "Epilogue", "Bardorba reunion" }, // - { 68, 0, "Epilogue", "Ashley patrols the streets" }, // - - // Wine Cellar - { 9, 0, "Wine Cellar", "Entrance to Darkness" }, // - { 9, 1, "Wine Cellar", "Room of Cheap Red Wine" }, // - { 9, 2, "Wine Cellar", "Room of Cheap White Wine" }, // - { 9, 3, "Wine Cellar", "Hall of Struggle" }, // - { 9, 4, "Wine Cellar", "Smokebarrel Stair" }, // - { 9, 5, "Wine Cellar", "Wine Guild Hall" }, // - { 9, 6, "Wine Cellar", "Wine Magnate's Chambers" }, // - { 9, 7, "Wine Cellar", "Fine Vintage Vault" }, // - { 9, 8, "Wine Cellar", "Chamber of Fear" }, // - { 9, 9, "Wine Cellar", "The Reckoning Room" }, // - { 9, 10, "Wine Cellar", "A Laborer's Thirst" }, // - { 9, 11, "Wine Cellar", "The Rich Drown in Wine" }, // - { 9, 12, "Wine Cellar", "Room of Rotten Grapes" }, // - { 9, 13, "Wine Cellar", "Chamber of Fear" }, // - { 9, 15, "Wine Cellar", "The Greedy One's Den" }, // - { 9, 16, "Wine Cellar", "Worker's Breakroom" }, // - { 9, 17, "Wine Cellar", "Blackmarket of Wines" }, // - { 9, 18, "Wine Cellar", "Room of Rotten Grapes" }, // - { 11, 0, "Wine Cellar", "The Hero's Winehall" }, // - { 12, 0, "Wine Cellar", "The Gallows" }, // - { 12, 1, "Wine Cellar", "The Gallows" }, // - - // Catacombs - { 13, 0, "Catacombs", "Hall of Sworn Revenge" }, // - { 13, 1, "Catacombs", "The Last Blessing" }, // - { 13, 2, "Catacombs", "The Weeping Corridor" }, // - { 13, 3, "Catacombs", "Persecution Hall" }, // - { 13, 4, "Catacombs", "The Lamenting Mother" }, // - { 13, 5, "Catacombs", "Rodent-Ridden Chamber" }, // - { 13, 6, "Catacombs", "Shrine to the Martyrs" }, // - { 13, 8, "Catacombs", "Hall of Dying Hope" }, // - { 13, 9, "Catacombs", "Bandits' Hideout" }, // - { 13, 10, "Catacombs", "The Bloody Hallway" }, // - { 13, 11, "Catacombs", "Faith Overcame Fear" }, // - { 13, 12, "Catacombs", "The Withered Spring" }, // - { 13, 13, "Catacombs", "Repent, O ye Sinners" }, // - { 13, 14, "Catacombs", "The Reaper's Victims" }, // - { 13, 15, "Catacombs", "The Last Stab of Hope" }, // - { 13, 16, "Catacombs", "Hallway of Heroes" }, // - { 13, 17, "Catacombs", "The Lamenting Mother" }, // - { 14, 0, "Catacombs", "The Beast's Domain" }, // - { 42, 0, "Catacombs", "Workshop \"Work of Art\"" }, // - - // Sanctum - { 15, 0, "Sanctum", "Prisoners' Niche" }, // - { 15, 1, "Sanctum", "Corridor of the Clerics" }, // - { 15, 2, "Sanctum", "Priests' Confinement" }, // - { 15, 3, "Sanctum", "Alchemists' Laboratory" }, // - { 15, 4, "Sanctum", "Theology Classroom" }, // - { 15, 5, "Sanctum", "Shrine of the Martyrs" }, // - { 15, 6, "Sanctum", "Advent Ground" }, // - { 15, 7, "Sanctum", "Passage of the Refugees" }, // - { 15, 8, "Sanctum", "Passage of the Refugees" }, // - { 15, 10, "Sanctum", "Stairway to the Light" }, // - { 15, 11, "Sanctum", "Hallowed Hope" }, // - { 15, 12, "Sanctum", "The Academia Corridor" }, // - { 16, 0, "Sanctum", "Hall of Sacrilege" }, // - { 17, 0, "Sanctum", "The Cleansing Chantry" }, // - - // Abandoned Mines B1 - { 50, 0, "Abandoned Mines B1", "Dreamers' Entrance" }, // - { 50, 1, "Abandoned Mines B1", "Miners' Resting Hall" }, // - { 50, 2, "Abandoned Mines B1", "The Crossing" }, // - { 50, 3, "Abandoned Mines B1", "Conflict and Accord" }, // - { 50, 4, "Abandoned Mines B1", "The Suicide King" }, // - { 50, 5, "Abandoned Mines B1", "The End of the Line" }, // - { 50, 6, "Abandoned Mines B1", "The Battle's Beginning" }, // - { 50, 7, "Abandoned Mines B1", "What Lies Ahead?" }, // - { 50, 8, "Abandoned Mines B1", "The Fruits of Friendship" }, // - { 50, 9, "Abandoned Mines B1", "The Earthquake's Mark" }, // - { 50, 10, "Abandoned Mines B1", "Coal Mine Storage" }, // - { 50, 11, "Abandoned Mines B1", "The Passion of Lovers" }, // - { 50, 12, "Abandoned Mines B1", "The Hall of Hope" }, // - { 50, 13, "Abandoned Mines B1", "The Dark Tunnel" }, // - { 50, 14, "Abandoned Mines B1", "Rust in Peace" }, // - { 50, 15, "Abandoned Mines B1", "Everwant Passage" }, // - { 50, 16, "Abandoned Mines B1", "Mining Regrets" }, // - { 50, 17, "Abandoned Mines B1", "The Smeltry" }, // - { 50, 18, "Abandoned Mines B1", "Clash of Hyaenas" }, // - { 50, 19, "Abandoned Mines B1", "Greed Knows No Bounds" }, // - { 50, 20, "Abandoned Mines B1", "Live Long and Prosper" }, // - { 50, 21, "Abandoned Mines B1", "Pray to the Mineral Gods" }, // - { 50, 22, "Abandoned Mines B1", "Traitor's Parting" }, // - { 50, 23, "Abandoned Mines B1", "Escapeway" }, // - - // Abandoned Mines B2 - { 51, 0, "Abandoned Mines B2", "Gambler's Passage" }, // - { 51, 1, "Abandoned Mines B2", "Treaty Room" }, // - { 51, 2, "Abandoned Mines B2", "The Miner's End" }, // - { 51, 3, "Abandoned Mines B2", "Work, Then Die" }, // - { 51, 4, "Abandoned Mines B2", "Bandits' Hollow" }, // - { 51, 5, "Abandoned Mines B2", "Delusions of Happiness" }, // - { 51, 6, "Abandoned Mines B2", "Dining in Darkness" }, // - { 51, 7, "Abandoned Mines B2", "Subtellurian Horrors" }, // - { 51, 8, "Abandoned Mines B2", "Hidden Resources" }, // - { 51, 9, "Abandoned Mines B2", "Way of Lost Children" }, // - { 51, 10, "Abandoned Mines B2", "Hall of the Empty Sconce" }, // - { 51, 11, "Abandoned Mines B2", "Acolyte's Burial Vault" }, // - { 51, 12, "Abandoned Mines B2", "Hall of Contemplation" }, // - { 51, 13, "Abandoned Mines B2", "The Abandoned Catspaw" }, // - { 51, 14, "Abandoned Mines B2", "Tomb of the Reborn" }, // - { 51, 15, "Abandoned Mines B2", "The Fallen Bricklayer" }, // - { 51, 16, "Abandoned Mines B2", "Crossing of Blood" }, // - { 51, 17, "Abandoned Mines B2", "Fool's Gold, Fool's Loss" }, // - { 51, 18, "Abandoned Mines B2", "Cry of the Beast" }, // - { 51, 19, "Abandoned Mines B2", "Senses Lost" }, // - { 51, 20, "Abandoned Mines B2", "Desire's Passage" }, // - { 51, 21, "Abandoned Mines B2", "Kilroy Was Here" }, // - { 51, 22, "Abandoned Mines B2", "Suicidal Desires" }, // - { 51, 23, "Abandoned Mines B2", "The Ore of Legend" }, // - { 51, 24, "Abandoned Mines B2", "Lambs to the Slaughter" }, // - { 51, 25, "Abandoned Mines B2", "A Wager of Noble Gold" }, // - { 51, 26, "Abandoned Mines B2", "The Lunatic Veins" }, // - { 51, 27, "Abandoned Mines B2", "Corridor of Shade" }, // - { 51, 28, "Abandoned Mines B2", "Revelation Shaft" }, // - - // Limestone Quarry - { 53, 0, "Limestone Quarry", "Dark Abhors Light" }, // - { 53, 1, "Limestone Quarry", "Dream of the Holy Land" }, // - { 53, 2, "Limestone Quarry", "The Ore Road" }, // - { 53, 3, "Limestone Quarry", "Atone for Eternity" }, // - { 53, 4, "Limestone Quarry", "The Air Stirs" }, // - { 53, 5, "Limestone Quarry", "Bonds of Friendship" }, // - { 53, 6, "Limestone Quarry", "Stair to Sanctuary" }, // - { 53, 7, "Limestone Quarry", "The Fallen Hall" }, // - { 53, 8, "Limestone Quarry", "The Rotten Core" }, // - { 53, 9, "Limestone Quarry", "Bacchus is Cheap" }, // - { 53, 10, "Limestone Quarry", "Screams of the Wounded" }, // - { 53, 11, "Limestone Quarry", "The Ore-Bearers" }, // - { 53, 12, "Limestone Quarry", "The Dreamer's Climb" }, // - { 53, 13, "Limestone Quarry", "Sinner's Sustenence" }, // - { 53, 14, "Limestone Quarry", "The Timely Dew of Sleep" }, // - { 53, 15, "Limestone Quarry", "Companions in Arms" }, // - { 53, 16, "Limestone Quarry", "The Auction Block" }, // - { 53, 17, "Limestone Quarry", "Ascension" }, // - { 53, 18, "Limestone Quarry", "Where the Serpent Hunts" }, // - { 53, 19, "Limestone Quarry", "Ants Prepare for Winter" }, // - { 53, 20, "Limestone Quarry", "Drowned in Fleeting Joy" }, // - { 53, 21, "Limestone Quarry", "The Laborer's Bonfire" }, // - { 53, 22, "Limestone Quarry", "Stone and Sulfurous Fire" }, // - { 53, 23, "Limestone Quarry", "Torture Without End" }, // - { 53, 24, "Limestone Quarry", "Way Down" }, // - { 53, 25, "Limestone Quarry", "Excavated Hollow" }, // - { 53, 26, "Limestone Quarry", "Parting Regrets" }, // - { 53, 27, "Limestone Quarry", "Corridor of Tales" }, // - { 53, 28, "Limestone Quarry", "Dust Shall Eat the Days" }, // - { 53, 29, "Limestone Quarry", "Hall of the Wage-Paying" }, // - { 53, 31, "Limestone Quarry", "Tunnel of the Heartless" }, // - - // Temple of Kiltia - { 30, 0, "Temple of Kiltia", "The Dark Coast" }, // - { 30, 1, "Temple of Kiltia", "Hall of Prayer" }, // - { 30, 2, "Temple of Kiltia", "Those who Drink the Dark" }, // - { 30, 3, "Temple of Kiltia", "The Chapel of Meschaunce" }, // - { 30, 4, "Temple of Kiltia", "The Resentful Ones" }, // - { 30, 5, "Temple of Kiltia", "Those who Fear the Light" }, // - { 31, 0, "Temple of Kiltia", "Chamber of Reason" }, // - { 31, 1, "Temple of Kiltia", "Exit to City Center" }, // - - // Great Cathedral B1 - { 22, 0, "Great Cathedral B1", "Sanity and Madness" }, // - { 22, 4, "Great Cathedral B1", "Truth and Lies" }, // - { 22, 6, "Great Cathedral B1", "Order and Chaos" }, // - { 22, 7, "Great Cathedral B1", "The Victor's Laurels" }, // - { 22, 8, "Great Cathedral B1", "Struggle for the Soul" }, // - { 22, 9, "Great Cathedral B1", "An Offering of Souls" }, // - - // Great Cathedral L1 - { 24, 0, "Great Cathedral L1", "The Flayed Confessional" }, // - { 24, 1, "Great Cathedral L1", "Monk's Leap" }, // - { 24, 2, "Great Cathedral L1", "Where Darkness Spreads" }, // - { 24, 3, "Great Cathedral L1", "Hieratic Recollections" }, // - { 24, 4, "Great Cathedral L1", "A Light in the Dark" }, // - { 24, 5, "Great Cathedral L1", "The Poisoned Chapel" }, // - { 24, 6, "Great Cathedral L1", "Sin and Punishment" }, // - { 24, 7, "Great Cathedral L1", "Cracked Pleasures" }, // - { 24, 8, "Great Cathedral L1", "Into Holy Battle" }, // - - // Great Cathedral L2 - { 23, 1, "Great Cathedral L2", "He Screams for Mercy" }, // - { 23, 2, "Great Cathedral L2", "Light and Dark Wage War" }, // - { 23, 3, "Great Cathedral L2", "Abasement from Above" }, // - { 24, 9, "Great Cathedral L2", "Maelstrom of Malice" }, // - { 24, 10, "Great Cathedral L2", "The Acolyte's Weakness" }, // - { 24, 11, "Great Cathedral L2", "The Hall of Broken Vows" }, // - { 24, 12, "Great Cathedral L2", "The Melodics of Madness" }, // - { 24, 13, "Great Cathedral L2", "Free from Base Desires" }, // - { 24, 14, "Great Cathedral L2", "The Convent Room" }, // - { 25, 0, "Great Cathedral L2", "An Arrow into Darkness" }, // - { 25, 1, "Great Cathedral L2", "What Ails You, Kills You" }, // - - // Great Cathedral L3 - { 23, 4, "Great Cathedral L3", "The Heretics' Story" }, // - { 23, 5, "Great Cathedral L3", "The Wine-Lecher's Fall" }, // - { 24, 15, "Great Cathedral L3", "Hopes of the Idealist" }, // - { 25, 2, "Great Cathedral L3", "Where the Soul Rots" }, // - { 25, 3, "Great Cathedral L3", "Despair of the Fallen" }, // - - // Great Cathedral L4 - { 25, 4, "Great Cathedral L4", "The Atrium" }, // - - // Forgotten Pathway - { 54, 0, "Forgotten Pathway", "Stair to the Sinners" }, // - { 54, 1, "Forgotten Pathway", "Slaugher of the Innocent" }, // - { 54, 2, "Forgotten Pathway", "The Fallen Knight" }, // - { 54, 3, "Forgotten Pathway", "The Oracle Sins No More" }, // - { 54, 4, "Forgotten Pathway", "Awaiting Retribution" }, // - - // Escapeway - { 52, 0, "Escapeway", "Shelter From the Quake" }, // - { 52, 1, "Escapeway", "Buried Alive" }, // - { 52, 2, "Escapeway", "Movement of Fear" }, // - { 52, 3, "Escapeway", "Facing Your Illusions" }, // - { 52, 4, "Escapeway", "The Darkness Drinks" }, // - { 52, 5, "Escapeway", "Fear and Loathing" }, // - { 52, 6, "Escapeway", "Blood and the Beast" }, // - { 52, 7, "Escapeway", "Where Body and Soul Part" }, // - - // Iron Maiden B1 - { 55, 0, "Iron Maiden B1", "The Cage" }, // - { 55, 1, "Iron Maiden B1", "The Cauldron" }, // - { 55, 2, "Iron Maiden B1", "Wooden Horse" }, // - { 55, 3, "Iron Maiden B1", "Starvation" }, // - { 55, 4, "Iron Maiden B1", "The Breast Ripper" }, // - { 55, 5, "Iron Maiden B1", "The Pear" }, // - { 55, 6, "Iron Maiden B1", "The Whirligig" }, // - { 55, 7, "Iron Maiden B1", "Spanish Tickler" }, // - { 55, 8, "Iron Maiden B1", "Heretic's Fork" }, // - { 55, 9, "Iron Maiden B1", "The Chair of Spikes" }, // - { 55, 10, "Iron Maiden B1", "Blooding" }, // - { 55, 11, "Iron Maiden B1", "Bootikens" }, // - { 55, 12, "Iron Maiden B1", "Burial" }, // - { 55, 13, "Iron Maiden B1", "Burning" }, // - { 55, 14, "Iron Maiden B1", "Cleansing the Soul" }, // - { 55, 15, "Iron Maiden B1", "The Garotte" }, // - { 55, 16, "Iron Maiden B1", "Hanging" }, // - { 55, 17, "Iron Maiden B1", "Impalement" }, // - { 55, 18, "Iron Maiden B1", "Knotting" }, // - { 55, 19, "Iron Maiden B1", "The Branks" }, // - { 55, 20, "Iron Maiden B1", "The Wheel" }, // - { 55, 21, "Iron Maiden B1", "The Judas Cradle" }, // - { 55, 22, "Iron Maiden B1", "The Ducking Stool" }, // - - // Iron Maiden B2 - { 56, 0, "Iron Maiden B2", "The Eunics' Lot" }, // - { 56, 1, "Iron Maiden B2", "Ordeal By Fire" }, // - { 56, 2, "Iron Maiden B2", "Tablillas" }, // - { 56, 3, "Iron Maiden B2", "The Oven at Neisse" }, // - { 56, 4, "Iron Maiden B2", "Strangulation" }, // - { 56, 5, "Iron Maiden B2", "Pressing" }, // - { 56, 6, "Iron Maiden B2", "The Strappado" }, // - { 56, 7, "Iron Maiden B2", "The Mind Burns" }, // - { 56, 8, "Iron Maiden B2", "Thumbscrews" }, // - { 56, 9, "Iron Maiden B2", "The Rack" }, // - { 56, 10, "Iron Maiden B2", "The Saw" }, // - { 56, 11, "Iron Maiden B2", "Ordeal By Water" }, // - { 56, 12, "Iron Maiden B2", "The Cold's Bridle" }, // - { 56, 13, "Iron Maiden B2", "Brank" }, // - { 56, 14, "Iron Maiden B2", "The Shin-Vice" }, // - { 56, 15, "Iron Maiden B2", "Squassation" }, // - { 56, 16, "Iron Maiden B2", "The Spider" }, // - { 56, 17, "Iron Maiden B2", "Lead Sprinkler" }, // - { 56, 18, "Iron Maiden B2", "Pendulum" }, // - { 56, 19, "Iron Maiden B2", "Dragging" }, // - { 56, 20, "Iron Maiden B2", "Tongue Slicer" }, // - { 56, 21, "Iron Maiden B2", "Tormentum Insomniae" }, // - - // Iron Maiden B3 - { 56, 22, "Iron Maiden B3", "The Iron Maiden" }, // - { 56, 23, "Iron Maiden B3", "Saint Elmo's Belt" }, // - { 56, 24, "Iron Maiden B3", "Judgement" }, // - { 56, 25, "Iron Maiden B3", "Dunking the Witch" }, // - - // Undercity West - { 47, 0, "Undercity West", "Workshop \"Godhands\"" }, // - { 48, 0, "Undercity West", "The Bread Peddler's Way" }, // - { 48, 1, "Undercity West", "Way of the Mother Lode" }, // - { 48, 2, "Undercity West", "Sewer of Ravenous Rats" }, // - { 48, 3, "Undercity West", "Underdark Fishmarket" }, // - { 48, 4, "Undercity West", "The Sunless Way" }, // - { 48, 5, "Undercity West", "Remembering Days of Yore" }, // - { 48, 6, "Undercity West", "Where the Hunter Climbed" }, // - { 48, 7, "Undercity West", "Larder for a Lean Winter" }, // - { 48, 8, "Undercity West", "Hall of Poverty" }, // - { 48, 9, "Undercity West", "The Washing-Woman's Way" }, // - { 48, 10, "Undercity West", "Beggars of the Mouthharp" }, // - { 48, 11, "Undercity West", "Corner of the Wretched" }, // - { 48, 12, "Undercity West", "Path to the Greengrocer" }, // - { 48, 13, "Undercity West", "Crossroads of Rest" }, // - { 48, 14, "Undercity West", "Path of the Children" }, // - { 48, 15, "Undercity West", "Fear of the Fall" }, // - { 48, 16, "Undercity West", "Sinner's Corner" }, // - { 48, 17, "Undercity West", "Nameless Dark Oblivion" }, // - { 48, 18, "Undercity West", "Corner of Prayers" }, // - { 48, 19, "Undercity West", "Hope Obstructed" }, // - { 48, 20, "Undercity West", "The Children's Hideout" }, // - { 48, 21, "Undercity West", "The Crumbling Market" }, // - { 48, 22, "Undercity West", "Tears from Empty Sockets" }, // - { 48, 23, "Undercity West", "Where Flood Waters Ran" }, // - { 48, 24, "Undercity West", "The Body Fragile Yields" }, // - { 48, 25, "Undercity West", "Salvation for the Mother" }, // - { 48, 26, "Undercity West", "Bite the Master's Wounds" }, // - - { 49, 0, "Undercity East", "Hall to a New World" }, // - { 49, 1, "Undercity East", "Place of Free Words" }, // - { 49, 2, "Undercity East", "Bazaar of the Bizarre" }, // - { 49, 3, "Undercity East", "Noble Gold and Silk" }, // - { 49, 4, "Undercity East", "A Knight Sells his Sword" }, // - { 49, 5, "Undercity East", "Gemsword Blackmarket" }, // - { 49, 6, "Undercity East", "The Pirate's Son" }, // - { 49, 7, "Undercity East", "Sale of the Sword" }, // - { 49, 8, "Undercity East", "Weapons Not Allowed" }, // - { 49, 9, "Undercity East", "The Greengrocer's Stair" }, // - { 49, 10, "Undercity East", "Where Black Waters Ran" }, // - { 49, 11, "Undercity East", "Arms Against Invaders" }, // - { 49, 12, "Undercity East", "Catspaw Blackmarket" }, // - - // The Keep - { 29, 0, "The Keep", "The Warrior's Rest" }, // - { 29, 2, "The Keep", "The Soldier's Bedding" }, // - { 29, 3, "The Keep", "A Storm of Arrows" }, // - { 29, 4, "The Keep", "Urge the Boy On" }, // - { 29, 5, "The Keep", "A Taste of the Spoils" }, // - { 29, 6, "The Keep", "Wiping Blood from Blades" }, // - { 44, 0, "The Keep", "Workshop \"Keane's Crafts\"" }, // - - // City Walls West - { 28, 0, "City Walls West", "Students of Death" }, // - { 28, 1, "City Walls West", "The Gabled Hall" }, // - { 28, 2, "City Walls West", "Where the Master Fell" }, // - - // City Walls South - { 28, 3, "City Walls South", "The Weeping Boy" }, // - { 28, 4, "City Walls South", "Swords for the Land" }, // - { 28, 5, "City Walls South", "In Wait of the Foe" }, // - { 28, 6, "City Walls South", "Where Weary Riders Rest" }, // - { 28, 7, "City Walls South", "The Boy's Training Room" }, // - - // City Walls East - { 28, 8, "City Walls East", "Train and Grow Strong" }, // - { 28, 9, "City Walls East", "The Squire's Gathering" }, // - { 28, 10, "City Walls East", "The Invaders are Found" }, // - { 28, 11, "City Walls East", "The Dream-Weavers" }, // - { 28, 12, "City Walls East", "The Cornered Savage" }, // - - { 28, 13, "City Walls North", "Traces of Invasion Past" }, // - { 28, 14, "City Walls North", "From Squire to Knight" }, // - { 28, 15, "City Walls North", "Be for Battle Prepared" }, // - { 28, 16, "City Walls North", "Destruction and Rebirth" }, // - { 28, 17, "City Walls North", "From Boy to Hero" }, // - { 28, 18, "City Walls North", "A Welcome Invasion" }, // - - // Snowfly Forest - { 40, 0, "Snowfly Forest", "The Hunt Begins" }, // - { 40, 1, "Snowfly Forest", "Which Way Home" }, // - { 40, 2, "Snowfly Forest", "The Giving Trees" }, // - { 40, 3, "Snowfly Forest", "The Wounded Boar" }, // - { 40, 4, "Snowfly Forest", "Golden Egg Way" }, // - { 40, 5, "Snowfly Forest", "The Birds and the Bees" }, // - { 40, 6, "Snowfly Forest", "The Woodcutter's Run" }, // - { 40, 7, "Snowfly Forest", "The Wolves' Choice" }, // - { 40, 8, "Snowfly Forest", "Howl of the Wolf King" }, // - { 40, 9, "Snowfly Forest", "Fluttering Hope" }, // - { 40, 10, "Snowfly Forest", "Traces of the Beast" }, // - { 40, 11, "Snowfly Forest", "The Yellow Wood" }, // - { 40, 12, "Snowfly Forest", "They Also Feed" }, // - { 40, 13, "Snowfly Forest", "Where Soft Rains Fell" }, // - { 40, 14, "Snowfly Forest", "The Spirit Trees" }, // - { 40, 15, "Snowfly Forest", "The Silent Hedges" }, // - { 40, 16, "Snowfly Forest", "Lamenting to the Moon" }, // - { 40, 17, "Snowfly Forest", "The Hollow Hills" }, // - { 40, 18, "Snowfly Forest", "Running with the Wolves" }, // - { 40, 19, "Snowfly Forest", "You Are the Prey" }, // - { 40, 20, "Snowfly Forest", "The Secret Path" }, // - { 40, 21, "Snowfly Forest", "The Faerie Circle" }, // - { 40, 22, "Snowfly Forest", "Return to the Land" }, // - { 40, 23, "Snowfly Forest", "Forest River" }, // - { 40, 24, "Snowfly Forest", "Hewn from Nature" }, // - { 40, 25, "Snowfly Forest", "The Wood Gate" }, // - - // Snowfly Forest East - { 41, 0, "Snowfly Forest East", "Steady the Boar-Spears" }, // - { 41, 1, "Snowfly Forest East", "The Boar's Revenge" }, // - { 41, 2, "Snowfly Forest East", "Nature's Womb" }, // - - // Town Center West - { 32, 0, "Town Center West", "Rue Vermillion" }, // - { 32, 1, "Town Center West", "The Rene Coastroad" }, // - { 32, 2, "Town Center West", "Rue Mal Fallde" }, // - { 32, 3, "Town Center West", "Tircolas Flow" }, // - { 32, 4, "Town Center West", "Glacialdra Kirk Ruins" }, // - { 32, 5, "Town Center West", "Rue Bouquet" }, // - { 32, 6, "Town Center West", "Villeport Way" }, // - { 32, 7, "Town Center West", "Rue Sant D'alsa" }, // - { 34, 0, "Town Center West", "Dinas Walk" }, // - { 43, 0, "Town Center West", "Workshop \"Magic Hammer\"" }, // - - { 32, 8, "Town Center South", "Valdiman Gates" }, // - { 32, 9, "Town Center South", "Rue Faltes" }, // - { 32, 10, "Town Center South", "Forcas Rise" }, // - { 32, 11, "Town Center South", "Rue Aliano" }, // - { 32, 12, "Town Center South", "Rue Volnac" }, // - { 32, 13, "Town Center South", "Rue Morgue" }, // - { 35, 0, "Town Center South", "Zebel's Walk" }, // - { 37, 0, "Town Center South", "The House Khazabas" }, // - - { 32, 15, "Town Center East", "Rue Lejour" }, // - { 32, 16, "Town Center East", "Kesch Bridge" }, // - { 32, 17, "Town Center East", "Rue Crimnade" }, // - { 32, 18, "Town Center East", "Rue Fisserano" }, // - { 32, 19, "Town Center East", "Shasras Hill Park" }, // - { 36, 0, "Town Center East", "Gharmes Walk" }, // - { 38, 0, "Town Center East", "The House Gilgitte" }, // - { 39, 0, "Town Center East", "Plateia Lumitar" }, // - { 45, 0, "Town Center East", "Workshop \"Metal Works\"" }, // - { 46, 0, "Town Center East", "Workshop \"Junction Point\"" }, // - - { 26, 0, "Great Cathedral L5", "Ashley finds dying Sydney" }, // - { 70, 0, "Somewhere...", "The Dark tempts Ashley" }, // - - { 27, 0, "The Paling", "Guildenstern fight - P1" }, // - { 27, 1, "The Paling", "Guildenstern fight - P2" } + // Loading screen + { 0, 0, L"In the void", L"Nothing to see here..." }, // + + // Intro 1 + { 1, 0, L"Intro", L"Guildenstern talks with the knight" }, // + { 2, 0, L"Intro", L"Ashley at the gate" }, // + { 3, 0, L"Intro", L"Ashley at the courtyard" }, // + { 4, 0, L"Intro", L"Ashley in the hall" }, // + { 5, 0, L"Intro", L"Ashley meets Sydney" }, // + { 6, 0, L"Intro", L"Ashley fights Wyvern" }, // + { 7, 0, L"Intro", L"Ashley walks to the window" }, // + { 8, 0, L"Intro", L"Ashley stares through the window" }, // + { 18, 0, L"Intro", L"Bardorba and Rosencrantz in Graylands Manor" }, // + { 33, 0, L"Intro", L"Merlose finds corpses at Lea Monde's entrance" }, // + { 10, 0, L"Intro", L"Ashley and Merlose at the tunnel entrance" }, // + { 9, 14, L"Intro", L"Ashley and Merlose at the Wine Cellar gate" }, // + + // Intro 2 + { 20, 0, L"Intro", L"VKP briefing" }, // + { 21, 0, L"Intro", L"Ashley meets Merlose outside manor" }, // + + // Outro + { 60, 0, L"Epilogue", L"Merlose, Hardin, and Joshua fleeing the city" }, // + { 61, 0, L"Epilogue", L"Pigmen crushed by the falling debris" }, // + { 62, 0, L"Epilogue", L"Tieger and Neesa stopped by Grissom" }, // + { 63, 0, L"Epilogue", L"Ashley carries Sydney" }, // + { 64, 0, L"Epilogue", L"Creatures of the dark vanish" }, // + { 65, 0, L"Epilogue", L"The Well explodes" }, // + { 66, 0, L"Epilogue", L"Hardin dies" }, // + { 67, 0, L"Epilogue", L"Bardorba reunion" }, // + { 68, 0, L"Epilogue", L"Ashley patrols the streets" }, // + + // Wine Cellar + { 9, 0, L"Wine Cellar", L"Entrance to Darkness" }, // + { 9, 1, L"Wine Cellar", L"Room of Cheap Red Wine" }, // + { 9, 2, L"Wine Cellar", L"Room of Cheap White Wine" }, // + { 9, 3, L"Wine Cellar", L"Hall of Struggle" }, // + { 9, 4, L"Wine Cellar", L"Smokebarrel Stair" }, // + { 9, 5, L"Wine Cellar", L"Wine Guild Hall" }, // + { 9, 6, L"Wine Cellar", L"Wine Magnate\'s Chambers" }, // + { 9, 7, L"Wine Cellar", L"Fine Vintage Vault" }, // + { 9, 8, L"Wine Cellar", L"Chamber of Fear" }, // + { 9, 9, L"Wine Cellar", L"The Reckoning Room" }, // + { 9, 10, L"Wine Cellar", L"A Laborer's Thirst" }, // + { 9, 11, L"Wine Cellar", L"The Rich Drown in Wine" }, // + { 9, 12, L"Wine Cellar", L"Room of Rotten Grapes" }, // + { 9, 13, L"Wine Cellar", L"Chamber of Fear" }, // + { 9, 15, L"Wine Cellar", L"The Greedy One's Den" }, // + { 9, 16, L"Wine Cellar", L"Worker's Breakroom" }, // + { 9, 17, L"Wine Cellar", L"Blackmarket of Wines" }, // + { 9, 18, L"Wine Cellar", L"Room of Rotten Grapes" }, // + { 11, 0, L"Wine Cellar", L"The Hero's Winehall" }, // + { 12, 0, L"Wine Cellar", L"The Gallows" }, // + { 12, 1, L"Wine Cellar", L"The Gallows" }, // + + // Catacombs + { 13, 0, L"Catacombs", L"Hall of Sworn Revenge" }, // + { 13, 1, L"Catacombs", L"The Last Blessing" }, // + { 13, 2, L"Catacombs", L"The Weeping Corridor" }, // + { 13, 3, L"Catacombs", L"Persecution Hall" }, // + { 13, 4, L"Catacombs", L"The Lamenting Mother" }, // + { 13, 5, L"Catacombs", L"Rodent-Ridden Chamber" }, // + { 13, 6, L"Catacombs", L"Shrine to the Martyrs" }, // + { 13, 8, L"Catacombs", L"Hall of Dying Hope" }, // + { 13, 9, L"Catacombs", L"Bandits' Hideout" }, // + { 13, 10, L"Catacombs", L"The Bloody Hallway" }, // + { 13, 11, L"Catacombs", L"Faith Overcame Fear" }, // + { 13, 12, L"Catacombs", L"The Withered Spring" }, // + { 13, 13, L"Catacombs", L"Repent, O ye Sinners" }, // + { 13, 14, L"Catacombs", L"The Reaper's Victims" }, // + { 13, 15, L"Catacombs", L"The Last Stab of Hope" }, // + { 13, 16, L"Catacombs", L"Hallway of Heroes" }, // + { 13, 17, L"Catacombs", L"The Lamenting Mother" }, // + { 14, 0, L"Catacombs", L"The Beast's Domain" }, // + { 42, 0, L"Catacombs", L"Workshop \"Work of Art\"" }, // + + // Sanctum + { 15, 0, L"Sanctum", L"Prisoners' Niche" }, // + { 15, 1, L"Sanctum", L"Corridor of the Clerics" }, // + { 15, 2, L"Sanctum", L"Priests' Confinement" }, // + { 15, 3, L"Sanctum", L"Alchemists' Laboratory" }, // + { 15, 4, L"Sanctum", L"Theology Classroom" }, // + { 15, 5, L"Sanctum", L"Shrine of the Martyrs" }, // + { 15, 6, L"Sanctum", L"Advent Ground" }, // + { 15, 7, L"Sanctum", L"Passage of the Refugees" }, // + { 15, 8, L"Sanctum", L"Passage of the Refugees" }, // + { 15, 10, L"Sanctum", L"Stairway to the Light" }, // + { 15, 11, L"Sanctum", L"Hallowed Hope" }, // + { 15, 12, L"Sanctum", L"The Academia Corridor" }, // + { 16, 0, L"Sanctum", L"Hall of Sacrilege" }, // + { 17, 0, L"Sanctum", L"The Cleansing Chantry" }, // + + // Abandoned Mines B1 + { 50, 0, L"Abandoned Mines B1", L"Dreamers' Entrance" }, // + { 50, 1, L"Abandoned Mines B1", L"Miners' Resting Hall" }, // + { 50, 2, L"Abandoned Mines B1", L"The Crossing" }, // + { 50, 3, L"Abandoned Mines B1", L"Conflict and Accord" }, // + { 50, 4, L"Abandoned Mines B1", L"The Suicide King" }, // + { 50, 5, L"Abandoned Mines B1", L"The End of the Line" }, // + { 50, 6, L"Abandoned Mines B1", L"The Battle's Beginning" }, // + { 50, 7, L"Abandoned Mines B1", L"What Lies Ahead?" }, // + { 50, 8, L"Abandoned Mines B1", L"The Fruits of Friendship" }, // + { 50, 9, L"Abandoned Mines B1", L"The Earthquake's Mark" }, // + { 50, 10, L"Abandoned Mines B1", L"Coal Mine Storage" }, // + { 50, 11, L"Abandoned Mines B1", L"The Passion of Lovers" }, // + { 50, 12, L"Abandoned Mines B1", L"The Hall of Hope" }, // + { 50, 13, L"Abandoned Mines B1", L"The Dark Tunnel" }, // + { 50, 14, L"Abandoned Mines B1", L"Rust in Peace" }, // + { 50, 15, L"Abandoned Mines B1", L"Everwant Passage" }, // + { 50, 16, L"Abandoned Mines B1", L"Mining Regrets" }, // + { 50, 17, L"Abandoned Mines B1", L"The Smeltry" }, // + { 50, 18, L"Abandoned Mines B1", L"Clash of Hyaenas" }, // + { 50, 19, L"Abandoned Mines B1", L"Greed Knows No Bounds" }, // + { 50, 20, L"Abandoned Mines B1", L"Live Long and Prosper" }, // + { 50, 21, L"Abandoned Mines B1", L"Pray to the Mineral Gods" }, // + { 50, 22, L"Abandoned Mines B1", L"Traitor's Parting" }, // + { 50, 23, L"Abandoned Mines B1", L"Escapeway" }, // + + // Abandoned Mines B2 + { 51, 0, L"Abandoned Mines B2", L"Gambler's Passage" }, // + { 51, 1, L"Abandoned Mines B2", L"Treaty Room" }, // + { 51, 2, L"Abandoned Mines B2", L"The Miner's End" }, // + { 51, 3, L"Abandoned Mines B2", L"Work, Then Die" }, // + { 51, 4, L"Abandoned Mines B2", L"Bandits' Hollow" }, // + { 51, 5, L"Abandoned Mines B2", L"Delusions of Happiness" }, // + { 51, 6, L"Abandoned Mines B2", L"Dining in Darkness" }, // + { 51, 7, L"Abandoned Mines B2", L"Subtellurian Horrors" }, // + { 51, 8, L"Abandoned Mines B2", L"Hidden Resources" }, // + { 51, 9, L"Abandoned Mines B2", L"Way of Lost Children" }, // + { 51, 10, L"Abandoned Mines B2", L"Hall of the Empty Sconce" }, // + { 51, 11, L"Abandoned Mines B2", L"Acolyte's Burial Vault" }, // + { 51, 12, L"Abandoned Mines B2", L"Hall of Contemplation" }, // + { 51, 13, L"Abandoned Mines B2", L"The Abandoned Catspaw" }, // + { 51, 14, L"Abandoned Mines B2", L"Tomb of the Reborn" }, // + { 51, 15, L"Abandoned Mines B2", L"The Fallen Bricklayer" }, // + { 51, 16, L"Abandoned Mines B2", L"Crossing of Blood" }, // + { 51, 17, L"Abandoned Mines B2", L"Fool's Gold, Fool's Loss" }, // + { 51, 18, L"Abandoned Mines B2", L"Cry of the Beast" }, // + { 51, 19, L"Abandoned Mines B2", L"Senses Lost" }, // + { 51, 20, L"Abandoned Mines B2", L"Desire's Passage" }, // + { 51, 21, L"Abandoned Mines B2", L"Kilroy Was Here" }, // + { 51, 22, L"Abandoned Mines B2", L"Suicidal Desires" }, // + { 51, 23, L"Abandoned Mines B2", L"The Ore of Legend" }, // + { 51, 24, L"Abandoned Mines B2", L"Lambs to the Slaughter" }, // + { 51, 25, L"Abandoned Mines B2", L"A Wager of Noble Gold" }, // + { 51, 26, L"Abandoned Mines B2", L"The Lunatic Veins" }, // + { 51, 27, L"Abandoned Mines B2", L"Corridor of Shade" }, // + { 51, 28, L"Abandoned Mines B2", L"Revelation Shaft" }, // + + // Limestone Quarry + { 53, 0, L"Limestone Quarry", L"Dark Abhors Light" }, // + { 53, 1, L"Limestone Quarry", L"Dream of the Holy Land" }, // + { 53, 2, L"Limestone Quarry", L"The Ore Road" }, // + { 53, 3, L"Limestone Quarry", L"Atone for Eternity" }, // + { 53, 4, L"Limestone Quarry", L"The Air Stirs" }, // + { 53, 5, L"Limestone Quarry", L"Bonds of Friendship" }, // + { 53, 6, L"Limestone Quarry", L"Stair to Sanctuary" }, // + { 53, 7, L"Limestone Quarry", L"The Fallen Hall" }, // + { 53, 8, L"Limestone Quarry", L"The Rotten Core" }, // + { 53, 9, L"Limestone Quarry", L"Bacchus is Cheap" }, // + { 53, 10, L"Limestone Quarry", L"Screams of the Wounded" }, // + { 53, 11, L"Limestone Quarry", L"The Ore-Bearers" }, // + { 53, 12, L"Limestone Quarry", L"The Dreamer's Climb" }, // + { 53, 13, L"Limestone Quarry", L"Sinner's Sustenence" }, // + { 53, 14, L"Limestone Quarry", L"The Timely Dew of Sleep" }, // + { 53, 15, L"Limestone Quarry", L"Companions in Arms" }, // + { 53, 16, L"Limestone Quarry", L"The Auction Block" }, // + { 53, 17, L"Limestone Quarry", L"Ascension" }, // + { 53, 18, L"Limestone Quarry", L"Where the Serpent Hunts" }, // + { 53, 19, L"Limestone Quarry", L"Ants Prepare for Winter" }, // + { 53, 20, L"Limestone Quarry", L"Drowned in Fleeting Joy" }, // + { 53, 21, L"Limestone Quarry", L"The Laborer's Bonfire" }, // + { 53, 22, L"Limestone Quarry", L"Stone and Sulfurous Fire" }, // + { 53, 23, L"Limestone Quarry", L"Torture Without End" }, // + { 53, 24, L"Limestone Quarry", L"Way Down" }, // + { 53, 25, L"Limestone Quarry", L"Excavated Hollow" }, // + { 53, 26, L"Limestone Quarry", L"Parting Regrets" }, // + { 53, 27, L"Limestone Quarry", L"Corridor of Tales" }, // + { 53, 28, L"Limestone Quarry", L"Dust Shall Eat the Days" }, // + { 53, 29, L"Limestone Quarry", L"Hall of the Wage-Paying" }, // + { 53, 31, L"Limestone Quarry", L"Tunnel of the Heartless" }, // + + // Temple of Kiltia + { 30, 0, L"Temple of Kiltia", L"The Dark Coast" }, // + { 30, 1, L"Temple of Kiltia", L"Hall of Prayer" }, // + { 30, 2, L"Temple of Kiltia", L"Those who Drink the Dark" }, // + { 30, 3, L"Temple of Kiltia", L"The Chapel of Meschaunce" }, // + { 30, 4, L"Temple of Kiltia", L"The Resentful Ones" }, // + { 30, 5, L"Temple of Kiltia", L"Those who Fear the Light" }, // + { 31, 0, L"Temple of Kiltia", L"Chamber of Reason" }, // + { 31, 1, L"Temple of Kiltia", L"Exit to City Center" }, // + + // Great Cathedral B1 + { 22, 0, L"Great Cathedral B1", L"Sanity and Madness" }, // + { 22, 4, L"Great Cathedral B1", L"Truth and Lies" }, // + { 22, 6, L"Great Cathedral B1", L"Order and Chaos" }, // + { 22, 7, L"Great Cathedral B1", L"The Victor's Laurels" }, // + { 22, 8, L"Great Cathedral B1", L"Struggle for the Soul" }, // + { 22, 9, L"Great Cathedral B1", L"An Offering of Souls" }, // + + // Great Cathedral L1 + { 24, 0, L"Great Cathedral L1", L"The Flayed Confessional" }, // + { 24, 1, L"Great Cathedral L1", L"Monk's Leap" }, // + { 24, 2, L"Great Cathedral L1", L"Where Darkness Spreads" }, // + { 24, 3, L"Great Cathedral L1", L"Hieratic Recollections" }, // + { 24, 4, L"Great Cathedral L1", L"A Light in the Dark" }, // + { 24, 5, L"Great Cathedral L1", L"The Poisoned Chapel" }, // + { 24, 6, L"Great Cathedral L1", L"Sin and Punishment" }, // + { 24, 7, L"Great Cathedral L1", L"Cracked Pleasures" }, // + { 24, 8, L"Great Cathedral L1", L"Into Holy Battle" }, // + + // Great Cathedral L2 + { 23, 1, L"Great Cathedral L2", L"He Screams for Mercy" }, // + { 23, 2, L"Great Cathedral L2", L"Light and Dark Wage War" }, // + { 23, 3, L"Great Cathedral L2", L"Abasement from Above" }, // + { 24, 9, L"Great Cathedral L2", L"Maelstrom of Malice" }, // + { 24, 10, L"Great Cathedral L2", L"The Acolyte's Weakness" }, // + { 24, 11, L"Great Cathedral L2", L"The Hall of Broken Vows" }, // + { 24, 12, L"Great Cathedral L2", L"The Melodics of Madness" }, // + { 24, 13, L"Great Cathedral L2", L"Free from Base Desires" }, // + { 24, 14, L"Great Cathedral L2", L"The Convent Room" }, // + { 25, 0, L"Great Cathedral L2", L"An Arrow into Darkness" }, // + { 25, 1, L"Great Cathedral L2", L"What Ails You, Kills You" }, // + + // Great Cathedral L3 + { 23, 4, L"Great Cathedral L3", L"The Heretics' Story" }, // + { 23, 5, L"Great Cathedral L3", L"The Wine-Lecher's Fall" }, // + { 24, 15, L"Great Cathedral L3", L"Hopes of the Idealist" }, // + { 25, 2, L"Great Cathedral L3", L"Where the Soul Rots" }, // + { 25, 3, L"Great Cathedral L3", L"Despair of the Fallen" }, // + + // Great Cathedral L4 + { 25, 4, L"Great Cathedral L4", L"The Atrium" }, // + + // Forgotten Pathway + { 54, 0, L"Forgotten Pathway", L"Stair to the Sinners" }, // + { 54, 1, L"Forgotten Pathway", L"Slaugher of the Innocent" }, // + { 54, 2, L"Forgotten Pathway", L"The Fallen Knight" }, // + { 54, 3, L"Forgotten Pathway", L"The Oracle Sins No More" }, // + { 54, 4, L"Forgotten Pathway", L"Awaiting Retribution" }, // + + // Escapeway + { 52, 0, L"Escapeway", L"Shelter From the Quake" }, // + { 52, 1, L"Escapeway", L"Buried Alive" }, // + { 52, 2, L"Escapeway", L"Movement of Fear" }, // + { 52, 3, L"Escapeway", L"Facing Your Illusions" }, // + { 52, 4, L"Escapeway", L"The Darkness Drinks" }, // + { 52, 5, L"Escapeway", L"Fear and Loathing" }, // + { 52, 6, L"Escapeway", L"Blood and the Beast" }, // + { 52, 7, L"Escapeway", L"Where Body and Soul Part" }, // + + // Iron Maiden B1 + { 55, 0, L"Iron Maiden B1", L"The Cage" }, // + { 55, 1, L"Iron Maiden B1", L"The Cauldron" }, // + { 55, 2, L"Iron Maiden B1", L"Wooden Horse" }, // + { 55, 3, L"Iron Maiden B1", L"Starvation" }, // + { 55, 4, L"Iron Maiden B1", L"The Breast Ripper" }, // + { 55, 5, L"Iron Maiden B1", L"The Pear" }, // + { 55, 6, L"Iron Maiden B1", L"The Whirligig" }, // + { 55, 7, L"Iron Maiden B1", L"Spanish Tickler" }, // + { 55, 8, L"Iron Maiden B1", L"Heretic's Fork" }, // + { 55, 9, L"Iron Maiden B1", L"The Chair of Spikes" }, // + { 55, 10, L"Iron Maiden B1", L"Blooding" }, // + { 55, 11, L"Iron Maiden B1", L"Bootikens" }, // + { 55, 12, L"Iron Maiden B1", L"Burial" }, // + { 55, 13, L"Iron Maiden B1", L"Burning" }, // + { 55, 14, L"Iron Maiden B1", L"Cleansing the Soul" }, // + { 55, 15, L"Iron Maiden B1", L"The Garotte" }, // + { 55, 16, L"Iron Maiden B1", L"Hanging" }, // + { 55, 17, L"Iron Maiden B1", L"Impalement" }, // + { 55, 18, L"Iron Maiden B1", L"Knotting" }, // + { 55, 19, L"Iron Maiden B1", L"The Branks" }, // + { 55, 20, L"Iron Maiden B1", L"The Wheel" }, // + { 55, 21, L"Iron Maiden B1", L"The Judas Cradle" }, // + { 55, 22, L"Iron Maiden B1", L"The Ducking Stool" }, // + + // Iron Maiden B2 + { 56, 0, L"Iron Maiden B2", L"The Eunics' Lot" }, // + { 56, 1, L"Iron Maiden B2", L"Ordeal By Fire" }, // + { 56, 2, L"Iron Maiden B2", L"Tablillas" }, // + { 56, 3, L"Iron Maiden B2", L"The Oven at Neisse" }, // + { 56, 4, L"Iron Maiden B2", L"Strangulation" }, // + { 56, 5, L"Iron Maiden B2", L"Pressing" }, // + { 56, 6, L"Iron Maiden B2", L"The Strappado" }, // + { 56, 7, L"Iron Maiden B2", L"The Mind Burns" }, // + { 56, 8, L"Iron Maiden B2", L"Thumbscrews" }, // + { 56, 9, L"Iron Maiden B2", L"The Rack" }, // + { 56, 10, L"Iron Maiden B2", L"The Saw" }, // + { 56, 11, L"Iron Maiden B2", L"Ordeal By Water" }, // + { 56, 12, L"Iron Maiden B2", L"The Cold's Bridle" }, // + { 56, 13, L"Iron Maiden B2", L"Brank" }, // + { 56, 14, L"Iron Maiden B2", L"The Shin-Vice" }, // + { 56, 15, L"Iron Maiden B2", L"Squassation" }, // + { 56, 16, L"Iron Maiden B2", L"The Spider" }, // + { 56, 17, L"Iron Maiden B2", L"Lead Sprinkler" }, // + { 56, 18, L"Iron Maiden B2", L"Pendulum" }, // + { 56, 19, L"Iron Maiden B2", L"Dragging" }, // + { 56, 20, L"Iron Maiden B2", L"Tongue Slicer" }, // + { 56, 21, L"Iron Maiden B2", L"Tormentum Insomniae" }, // + + // Iron Maiden B3 + { 56, 22, L"Iron Maiden B3", L"The Iron Maiden" }, // + { 56, 23, L"Iron Maiden B3", L"Saint Elmo's Belt" }, // + { 56, 24, L"Iron Maiden B3", L"Judgement" }, // + { 56, 25, L"Iron Maiden B3", L"Dunking the Witch" }, // + + // Undercity West + { 47, 0, L"Undercity West", L"Workshop \"Godhands\"" }, // + { 48, 0, L"Undercity West", L"The Bread Peddler's Way" }, // + { 48, 1, L"Undercity West", L"Way of the Mother Lode" }, // + { 48, 2, L"Undercity West", L"Sewer of Ravenous Rats" }, // + { 48, 3, L"Undercity West", L"Underdark Fishmarket" }, // + { 48, 4, L"Undercity West", L"The Sunless Way" }, // + { 48, 5, L"Undercity West", L"Remembering Days of Yore" }, // + { 48, 6, L"Undercity West", L"Where the Hunter Climbed" }, // + { 48, 7, L"Undercity West", L"Larder for a Lean Winter" }, // + { 48, 8, L"Undercity West", L"Hall of Poverty" }, // + { 48, 9, L"Undercity West", L"The Washing-Woman's Way" }, // + { 48, 10, L"Undercity West", L"Beggars of the Mouthharp" }, // + { 48, 11, L"Undercity West", L"Corner of the Wretched" }, // + { 48, 12, L"Undercity West", L"Path to the Greengrocer" }, // + { 48, 13, L"Undercity West", L"Crossroads of Rest" }, // + { 48, 14, L"Undercity West", L"Path of the Children" }, // + { 48, 15, L"Undercity West", L"Fear of the Fall" }, // + { 48, 16, L"Undercity West", L"Sinner's Corner" }, // + { 48, 17, L"Undercity West", L"Nameless Dark Oblivion" }, // + { 48, 18, L"Undercity West", L"Corner of Prayers" }, // + { 48, 19, L"Undercity West", L"Hope Obstructed" }, // + { 48, 20, L"Undercity West", L"The Children's Hideout" }, // + { 48, 21, L"Undercity West", L"The Crumbling Market" }, // + { 48, 22, L"Undercity West", L"Tears from Empty Sockets" }, // + { 48, 23, L"Undercity West", L"Where Flood Waters Ran" }, // + { 48, 24, L"Undercity West", L"The Body Fragile Yields" }, // + { 48, 25, L"Undercity West", L"Salvation for the Mother" }, // + { 48, 26, L"Undercity West", L"Bite the Master's Wounds" }, // + + { 49, 0, L"Undercity East", L"Hall to a New World" }, // + { 49, 1, L"Undercity East", L"Place of Free Words" }, // + { 49, 2, L"Undercity East", L"Bazaar of the Bizarre" }, // + { 49, 3, L"Undercity East", L"Noble Gold and Silk" }, // + { 49, 4, L"Undercity East", L"A Knight Sells his Sword" }, // + { 49, 5, L"Undercity East", L"Gemsword Blackmarket" }, // + { 49, 6, L"Undercity East", L"The Pirate's Son" }, // + { 49, 7, L"Undercity East", L"Sale of the Sword" }, // + { 49, 8, L"Undercity East", L"Weapons Not Allowed" }, // + { 49, 9, L"Undercity East", L"The Greengrocer's Stair" }, // + { 49, 10, L"Undercity East", L"Where Black Waters Ran" }, // + { 49, 11, L"Undercity East", L"Arms Against Invaders" }, // + { 49, 12, L"Undercity East", L"Catspaw Blackmarket" }, // + + // The Keep + { 29, 0, L"The Keep", L"The Warrior's Rest" }, // + { 29, 2, L"The Keep", L"The Soldier's Bedding" }, // + { 29, 3, L"The Keep", L"A Storm of Arrows" }, // + { 29, 4, L"The Keep", L"Urge the Boy On" }, // + { 29, 5, L"The Keep", L"A Taste of the Spoils" }, // + { 29, 6, L"The Keep", L"Wiping Blood from Blades" }, // + { 44, 0, L"The Keep", L"Workshop \"Keane's Crafts\"" }, // + + // City Walls West + { 28, 0, L"City Walls West", L"Students of Death" }, // + { 28, 1, L"City Walls West", L"The Gabled Hall" }, // + { 28, 2, L"City Walls West", L"Where the Master Fell" }, // + + // City Walls South + { 28, 3, L"City Walls South", L"The Weeping Boy" }, // + { 28, 4, L"City Walls South", L"Swords for the Land" }, // + { 28, 5, L"City Walls South", L"In Wait of the Foe" }, // + { 28, 6, L"City Walls South", L"Where Weary Riders Rest" }, // + { 28, 7, L"City Walls South", L"The Boy's Training Room" }, // + + // City Walls East + { 28, 8, L"City Walls East", L"Train and Grow Strong" }, // + { 28, 9, L"City Walls East", L"The Squire's Gathering" }, // + { 28, 10, L"City Walls East", L"The Invaders are Found" }, // + { 28, 11, L"City Walls East", L"The Dream-Weavers" }, // + { 28, 12, L"City Walls East", L"The Cornered Savage" }, // + + { 28, 13, L"City Walls North", L"Traces of Invasion Past" }, // + { 28, 14, L"City Walls North", L"From Squire to Knight" }, // + { 28, 15, L"City Walls North", L"Be for Battle Prepared" }, // + { 28, 16, L"City Walls North", L"Destruction and Rebirth" }, // + { 28, 17, L"City Walls North", L"From Boy to Hero" }, // + { 28, 18, L"City Walls North", L"A Welcome Invasion" }, // + + // Snowfly Forest + { 40, 0, L"Snowfly Forest", L"The Hunt Begins" }, // + { 40, 1, L"Snowfly Forest", L"Which Way Home" }, // + { 40, 2, L"Snowfly Forest", L"The Giving Trees" }, // + { 40, 3, L"Snowfly Forest", L"The Wounded Boar" }, // + { 40, 4, L"Snowfly Forest", L"Golden Egg Way" }, // + { 40, 5, L"Snowfly Forest", L"The Birds and the Bees" }, // + { 40, 6, L"Snowfly Forest", L"The Woodcutter's Run" }, // + { 40, 7, L"Snowfly Forest", L"The Wolves' Choice" }, // + { 40, 8, L"Snowfly Forest", L"Howl of the Wolf King" }, // + { 40, 9, L"Snowfly Forest", L"Fluttering Hope" }, // + { 40, 10, L"Snowfly Forest", L"Traces of the Beast" }, // + { 40, 11, L"Snowfly Forest", L"The Yellow Wood" }, // + { 40, 12, L"Snowfly Forest", L"They Also Feed" }, // + { 40, 13, L"Snowfly Forest", L"Where Soft Rains Fell" }, // + { 40, 14, L"Snowfly Forest", L"The Spirit Trees" }, // + { 40, 15, L"Snowfly Forest", L"The Silent Hedges" }, // + { 40, 16, L"Snowfly Forest", L"Lamenting to the Moon" }, // + { 40, 17, L"Snowfly Forest", L"The Hollow Hills" }, // + { 40, 18, L"Snowfly Forest", L"Running with the Wolves" }, // + { 40, 19, L"Snowfly Forest", L"You Are the Prey" }, // + { 40, 20, L"Snowfly Forest", L"The Secret Path" }, // + { 40, 21, L"Snowfly Forest", L"The Faerie Circle" }, // + { 40, 22, L"Snowfly Forest", L"Return to the Land" }, // + { 40, 23, L"Snowfly Forest", L"Forest River" }, // + { 40, 24, L"Snowfly Forest", L"Hewn from Nature" }, // + { 40, 25, L"Snowfly Forest", L"The Wood Gate" }, // + + // Snowfly Forest East + { 41, 0, L"Snowfly Forest East", L"Steady the Boar-Spears" }, // + { 41, 1, L"Snowfly Forest East", L"The Boar's Revenge" }, // + { 41, 2, L"Snowfly Forest East", L"Nature's Womb" }, // + + // Town Center West + { 32, 0, L"Town Center West", L"Rue Vermillion" }, // + { 32, 1, L"Town Center West", L"The Rene Coastroad" }, // + { 32, 2, L"Town Center West", L"Rue Mal Fallde" }, // + { 32, 3, L"Town Center West", L"Tircolas Flow" }, // + { 32, 4, L"Town Center West", L"Glacialdra Kirk Ruins" }, // + { 32, 5, L"Town Center West", L"Rue Bouquet" }, // + { 32, 6, L"Town Center West", L"Villeport Way" }, // + { 32, 7, L"Town Center West", L"Rue Sant D'alsa" }, // + { 34, 0, L"Town Center West", L"Dinas Walk" }, // + { 43, 0, L"Town Center West", L"Workshop \"Magic Hammer\"" }, // + + { 32, 8, L"Town Center South", L"Valdiman Gates" }, // + { 32, 9, L"Town Center South", L"Rue Faltes" }, // + { 32, 10, L"Town Center South", L"Forcas Rise" }, // + { 32, 11, L"Town Center South", L"Rue Aliano" }, // + { 32, 12, L"Town Center South", L"Rue Volnac" }, // + { 32, 13, L"Town Center South", L"Rue Morgue" }, // + { 35, 0, L"Town Center South", L"Zebel's Walk" }, // + { 37, 0, L"Town Center South", L"The House Khazabas" }, // + + { 32, 15, L"Town Center East", L"Rue Lejour" }, // + { 32, 16, L"Town Center East", L"Kesch Bridge" }, // + { 32, 17, L"Town Center East", L"Rue Crimnade" }, // + { 32, 18, L"Town Center East", L"Rue Fisserano" }, // + { 32, 19, L"Town Center East", L"Shasras Hill Park" }, // + { 36, 0, L"Town Center East", L"Gharmes Walk" }, // + { 38, 0, L"Town Center East", L"The House Gilgitte" }, // + { 39, 0, L"Town Center East", L"Plateia Lumitar" }, // + { 45, 0, L"Town Center East", L"Workshop \"Metal Works\"" }, // + { 46, 0, L"Town Center East", L"Workshop \"Junction Point\"" }, // + + { 26, 0, L"Great Cathedral L5", L"Ashley finds dying Sydney" }, // + { 70, 0, L"Somewhere...", L"The Dark tempts Ashley" }, // + + { 27, 0, L"The Paling", L"Guildenstern fight - P1" }, // + { 27, 1, L"The Paling", L"Guildenstern fight - P2" } }; void -ReadLocation() -{ - usize BytesToRead = sizeof(location); - usize BytesRead = - ReadGameMemory(processID, OFFSET_LOCATION, BytesToRead, &LocationCur); +ReadLocation() { + usize BytesToRead = sizeof(location); + usize BytesRead = + ReadGameMemory(processID, OFFSET_LOCATION, BytesToRead, &LocationCur); } BOOL -LocationChanged() -{ - usize DataSize = sizeof(location); +LocationChanged() { + usize DataSize = sizeof(location); - BOOL Result = - DataChanged((void *) &LocationPrev, (void *) &LocationCur, DataSize); + BOOL Result = + DataChanged((void *) &LocationPrev, (void *) &LocationCur, DataSize); - return Result; + return Result; } void -ReadZoneAndMapName(location *Location, char *ZoneName, char *MapName) -{ - // Clear the strings - ZoneName[0] = '\0'; - MapName[0] = '\0'; - - u8 ZoneNumber = Location->ZoneNumber; - u8 MapNumber = Location->MapNumber; - - int counter = _countof(MapDataList); - - for (int i = 0; i < counter; i++) - { - if (MapDataList[i].ZoneNumber == ZoneNumber && - MapDataList[i].MapNumber == MapNumber) - { - sprintf(ZoneName, "%s", MapDataList[i].ZoneName); - sprintf(MapName, "%s", MapDataList[i].MapName); - - break; +ReadZoneAndMapName(location *Location, wchar_t *ZoneName, wchar_t *MapName) { + // Clear the strings + ZoneName[0] = L'\0'; + MapName[0] = L'\0'; + + u8 ZoneNumber = Location->ZoneNumber; + u8 MapNumber = Location->MapNumber; + + int counter = _countof(MapDataList); + + for (int i = 0; i < counter; i++) { + if (MapDataList[i].ZoneNumber == ZoneNumber && + MapDataList[i].MapNumber == (MapNumber)) { + swprintf_s(ZoneName, LOCATION_MAX_NAME_LENGTH, L"%ls", MapDataList[i].ZoneName); + swprintf_s(MapName, LOCATION_MAX_NAME_LENGTH, L"%ls", MapDataList[i].MapName); + + break; + } } - } } void -ReadZoneAndMapNameCustom(location *Location, char *nameZone, char *nameMap) -{ - // Clear the strings - nameZone[0] = '\0'; - nameMap[0] = '\0'; - - u8 ZoneNumber = Location->ZoneNumber; - u8 MapNumber = Location->MapNumber; - - int counter = _countof(MapDataList); - - for (int i = 0; i < counter; i++) - { - if (MapDataList[i].ZoneNumber == ZoneNumber && - MapDataList[i].MapNumber == (MapNumber)) - { - sprintf(nameZone, "%s", MapDataList[i].ZoneName); - sprintf(nameMap, "%s", MapDataList[i].MapName); - - break; +ReadZoneAndMapNameCustom(location *Location, wchar_t *nameZone, wchar_t *nameMap) { + // Clear the strings + nameZone[0] = L'\0'; + nameMap[0] = L'\0'; + + u8 ZoneNumber = Location->ZoneNumber; + u8 MapNumber = Location->MapNumber; + + int counter = _countof(MapDataList); + + for (int i = 0; i < counter; i++) { + if (MapDataList[i].ZoneNumber == ZoneNumber && + MapDataList[i].MapNumber == MapNumber) { + swprintf_s(nameZone, LOCATION_MAX_NAME_LENGTH, L"%s", MapDataList[i].ZoneName); + swprintf_s(nameMap, LOCATION_MAX_NAME_LENGTH, L"%s", MapDataList[i].MapName); + + break; + } } - } } void -WriteLocation() -{ - u8 ZoneNumber = LocationCur.ZoneNumber; - u8 MapNumber = LocationCur.MapNumber; +WriteLocation() { + u8 ZoneNumber = LocationCur.ZoneNumber; + u8 MapNumber = LocationCur.MapNumber; - FILE *fpLocation = fopen("game_data/map/location.txt", "w"); - FILE *fpLocationDebug = fopen("game_data/map/location_debug.txt", "w"); + FILE *fpLocation = _wfopen(L"game_data/map/location.txt", L"w"); + FILE *fpLocationDebug = _wfopen(L"game_data/map/location_debug.txt", L"w"); - fprintf(fpLocation, "%s, %s\n", nameZone, nameMap); - fprintf(fpLocationDebug, "%i,%i,%s,%s\n", ZoneNumber, MapNumber, nameZone, - nameMap); + fwprintf(fpLocation, L"%s, %s\n", nameZone, nameMap); + fwprintf(fpLocationDebug, L"%i,%i,%s,%s\n", ZoneNumber, MapNumber, nameZone, + nameMap); - fclose(fpLocation); - fclose(fpLocationDebug); + fclose(fpLocation); + fclose(fpLocationDebug); } void -PrintLocation() -{ - u8 ZoneNumber = LocationCur.ZoneNumber; - u8 MapNumber = LocationCur.MapNumber; +PrintLocation() { + u8 ZoneNumber = LocationCur.ZoneNumber; + u8 MapNumber = LocationCur.MapNumber; - sprintf(szBuffer, "\n\nLOCATION:\n"); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"\n\nLOCATION:\n"); + WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "%s, %s ( Zone %i, Map %i )\n", - nameZone, nameMap, ZoneNumber, MapNumber); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"%s, %s ( Zone %i, Map %i )\n", + nameZone, nameMap, ZoneNumber, MapNumber); + WriteToBackBuffer(); } BOOL -IsThisTheLastBossMap() -{ - if ((LocationCur.ZoneNumber == 27) && (LocationCur.MapNumber == 1)) - { - return TRUE; - } - return FALSE; +IsThisTheLastBossMap() { + if ((LocationCur.ZoneNumber == 27) && (LocationCur.MapNumber == 1)) { + return TRUE; + } + return FALSE; } #endif + diff --git a/includes/vst_player.h b/includes/vst_player.h index e864772..78d060e 100644 --- a/includes/vst_player.h +++ b/includes/vst_player.h @@ -15,7 +15,7 @@ #define OFFSET_PLAYER_PTR_WEAPON_WEP_HDR 0x11fa38 // ptrWeaponWEPHdr #define OFFSET_PLAYER_PTR_00_SHP_DATA 0x11fa3c // ptr00ShpData #define OFFSET_PLAYER_CHARACTER_NAME \ - 0x11fa40 // CharacterName $18str "Ashley Riot" + 0x11fa40 // CharacterName $18str "Ashley Riot" // Main stats #define OFFSET_PLAYER_HP_CURRENT 0x11fa58 // CurrentHP @@ -30,7 +30,7 @@ #define OFFSET_PLAYER_AGL_EQUIPPED 0x11fa6a // EquippedAGL #define OFFSET_PLAYER_AGL_ORIGINAL 0x11fa6c // OriginalAGL #define OFFSET_PLAYER_WALKING_SPEED_WITH_BOX \ - 0x11fa71 // WalkingSpeedWhenCarryingBoxes + 0x11fa71 // WalkingSpeedWhenCarryingBoxes #define OFFSET_PLAYER_RUNNING_SPEED 0x11fa73 // RunningSpeed #define OFFSET_PLAYER_RANGE 0x11fa78 // range @@ -68,7 +68,7 @@ #define MASK_STATUS_EFFECT_WATER_RESIST 0x10000000 #define MASK_STATUS_EFFECT_ANALYZE 0x20000000 #define MASK_STATUS_EFFECT_EXORCISM 0x40000000 -#define MASK_STATUS_EFFECT_MAGIC_IMMMUNITY 0x000000 +#define MASK_STATUS_EFFECT_MAGIC_IMMMUNITY 0x80000000 // Last boss data #define OFFSET_LAST_BOSS_HP_CUR 0x17cd08 @@ -78,311 +78,288 @@ #define OFFSET_LAST_BOSS_SHD_CUR 0x17d088 #define OFFSET_LAST_BOSS_SHD_MAX 0x17d08a -char *StatusEffectNames[32] = { // - "DYING Head (silent)", "DYING Right Arm (damage 50%%)", - "DYING Left Arm (enemy hit%% x2)", - "DYING Body (RISK decay in Normal Mode as in Battle Mode)", - "DYING Legs (move 50%%)", "STR-down", "STR-up", "INT-down", "INT-up", - "AGI-down", "AGI-up", "Quicken", "Silence", "Paralysis", "Poison", "Numbness", - "Curse", "Regen", "Magic Ward ", "Equip-down", "Equip-up", "+Air", "+Fire", - "+Earth", "+Water", "Resist Air", "Resist Fire", "Resist Earth", - "Resist Water", "Analyze", "Exorcism/Banish/Drain mind", "Magic Immmunity?" +wchar_t *StatusEffectNames[32] = { // + L"DYING Head (silent)", L"DYING Right Arm (damage 50%%)", + L"DYING Left Arm (enemy hit%% x2)", + L"DYING Body (RISK decay in Normal Mode as in Battle Mode)", + L"DYING Legs (move 50%%)", L"STR-down", L"STR-up", L"INT-down", L"INT-up", + L"AGI-down", L"AGI-up", L"Quicken", L"Silence", L"Paralysis", L"Poison", L"Numbness", + L"Curse", L"Regen", L"Magic Ward ", L"Equip-down", L"Equip-up", L"+Air", L"+Fire", + L"+Earth", L"+Water", L"Resist Air", L"Resist Fire", L"Resist Earth", + L"Resist Water", L"Analyze", L"Exorcism/Banish/Drain mind", L"Magic Immmunity?" }; u32 StatusEffectMasks[32] = { // - MASK_STATUS_EFFECT_DYING_HEAD, MASK_STATUS_EFFECT_DYING_RIGHT_ARM, - MASK_STATUS_EFFECT_DYING_LEFT_ARM, MASK_STATUS_EFFECT_DYING_BODY, - MASK_STATUS_EFFECT_DYING_LEGS, MASK_STATUS_EFFECT_STR_DOWN, - MASK_STATUS_EFFECT_STR_UP, MASK_STATUS_EFFECT_INT_DOWN, - MASK_STATUS_EFFECT_INT_UP, MASK_STATUS_EFFECT_AGI_DOWN, - MASK_STATUS_EFFECT_AGI_UP, MASK_STATUS_EFFECT_QUICKEN, - MASK_STATUS_EFFECT_SILENCE, MASK_STATUS_EFFECT_PARALYSIS, - MASK_STATUS_EFFECT_POISON, MASK_STATUS_EFFECT_NUMBNESS, - MASK_STATUS_EFFECT_CURSE, MASK_STATUS_EFFECT_REGEN, - MASK_STATUS_EFFECT_MAGIC_WARD, MASK_STATUS_EFFECT_EQUIP_DOWN, - MASK_STATUS_EFFECT_EQUIP_UP, MASK_STATUS_EFFECT_AIR_UP, - MASK_STATUS_EFFECT_FIRE_UP, MASK_STATUS_EFFECT_EARTH_UP, - MASK_STATUS_EFFECT_WATER_UP, MASK_STATUS_EFFECT_AIR_RESIST, - MASK_STATUS_EFFECT_FIRE_RESIST, MASK_STATUS_EFFECT_EARTH_RESIST, - MASK_STATUS_EFFECT_WATER_RESIST, MASK_STATUS_EFFECT_ANALYZE, - MASK_STATUS_EFFECT_EXORCISM, MASK_STATUS_EFFECT_MAGIC_IMMMUNITY + MASK_STATUS_EFFECT_DYING_HEAD, MASK_STATUS_EFFECT_DYING_RIGHT_ARM, + MASK_STATUS_EFFECT_DYING_LEFT_ARM, MASK_STATUS_EFFECT_DYING_BODY, + MASK_STATUS_EFFECT_DYING_LEGS, MASK_STATUS_EFFECT_STR_DOWN, + MASK_STATUS_EFFECT_STR_UP, MASK_STATUS_EFFECT_INT_DOWN, + MASK_STATUS_EFFECT_INT_UP, MASK_STATUS_EFFECT_AGI_DOWN, + MASK_STATUS_EFFECT_AGI_UP, MASK_STATUS_EFFECT_QUICKEN, + MASK_STATUS_EFFECT_SILENCE, MASK_STATUS_EFFECT_PARALYSIS, + MASK_STATUS_EFFECT_POISON, MASK_STATUS_EFFECT_NUMBNESS, + MASK_STATUS_EFFECT_CURSE, MASK_STATUS_EFFECT_REGEN, + MASK_STATUS_EFFECT_MAGIC_WARD, MASK_STATUS_EFFECT_EQUIP_DOWN, + MASK_STATUS_EFFECT_EQUIP_UP, MASK_STATUS_EFFECT_AIR_UP, + MASK_STATUS_EFFECT_FIRE_UP, MASK_STATUS_EFFECT_EARTH_UP, + MASK_STATUS_EFFECT_WATER_UP, MASK_STATUS_EFFECT_AIR_RESIST, + MASK_STATUS_EFFECT_FIRE_RESIST, MASK_STATUS_EFFECT_EARTH_RESIST, + MASK_STATUS_EFFECT_WATER_RESIST, MASK_STATUS_EFFECT_ANALYZE, + MASK_STATUS_EFFECT_EXORCISM, MASK_STATUS_EFFECT_MAGIC_IMMMUNITY }; void -ReadPlayerStats(player_stats *PlayerStats) -{ - // usize Offset = - // (usize)(OFFSET_PLAYER_HP_CURRENT - PSX_TO_EMU + processBaseAddress); +ReadPlayerStats(player_stats *PlayerStats) { + // usize Offset = + // (usize)(OFFSET_PLAYER_HP_CURRENT - PSX_TO_EMU + processBaseAddress); - usize BytesToRead = sizeof(player_stats); + usize BytesToRead = sizeof(player_stats); - ReadGameMemory(processID, OFFSET_PLAYER_HP_CURRENT, BytesToRead, PlayerStats); + ReadGameMemory(processID, OFFSET_PLAYER_HP_CURRENT, BytesToRead, PlayerStats); } void -ReadPlayerEffects(status_effects *PlayerEffects) -{ +ReadPlayerEffects(status_effects *PlayerEffects) { - usize BytesToRead = sizeof(status_effects); + usize BytesToRead = sizeof(status_effects); - ReadGameMemory( - processID, OFFSET_PLAYER_STATUS_EFFECTS, BytesToRead, PlayerEffects); + ReadGameMemory( + processID, OFFSET_PLAYER_STATUS_EFFECTS, BytesToRead, PlayerEffects); } void -WritePlayerStats(player_stats *PlayerStats) -{ - FILE *fpPlayerStats = fopen("game_data/player/player_stats.txt", "w"); +WritePlayerStats(player_stats *PlayerStats) { + FILE *fpPlayerStats = _wfopen(L"game_data/player/player_stats.txt", L"w"); - fprintf(fpPlayerStats, "Player Stats\n\n"); + fwprintf(fpPlayerStats, L"Player Stats\n\n"); - fprintf( - fpPlayerStats, "HP: %3i/%3i\n", PlayerStats->HPCur, PlayerStats->HPMax); + fwprintf( + fpPlayerStats, L"HP: %3i/%3i\n", PlayerStats->HPCur, PlayerStats->HPMax); - fprintf( - fpPlayerStats, "MP: %3i/%3i\n", PlayerStats->MPCur, PlayerStats->MPMax); + fwprintf( + fpPlayerStats, L"MP: %3i/%3i\n", PlayerStats->MPCur, PlayerStats->MPMax); - fprintf(fpPlayerStats, "STR: %3i/%3i\n", PlayerStats->STRBase, - PlayerStats->STRCur); - fprintf(fpPlayerStats, "INT: %3i/%3i\n", PlayerStats->INTBase, - PlayerStats->INTCur); - fprintf(fpPlayerStats, "AGL: %3i/%3i\n", PlayerStats->AGLBase, - PlayerStats->AGLCur); + fwprintf(fpPlayerStats, L"STR: %3i/%3i\n", PlayerStats->STRBase, + PlayerStats->STRCur); + fwprintf(fpPlayerStats, L"INT: %3i/%3i\n", PlayerStats->INTBase, + PlayerStats->INTCur); + fwprintf(fpPlayerStats, L"AGL: %3i/%3i\n", PlayerStats->AGLBase, + PlayerStats->AGLCur); - fprintf(fpPlayerStats, "RISK: %3i\n\n", PlayerStats->Risk); + fwprintf(fpPlayerStats, L"RISK: %3i\n\n", PlayerStats->Risk); - fprintf(fpPlayerStats, "SPEED\n"); - fprintf(fpPlayerStats, "Running: %2i\n", PlayerStats->RunningSpeed); - fprintf(fpPlayerStats, "With box: %2i\n\n", PlayerStats->WalkingSpeedWithBox); + fwprintf(fpPlayerStats, L"SPEED\n"); + fwprintf(fpPlayerStats, L"Running: %2i\n", PlayerStats->RunningSpeed); + fwprintf(fpPlayerStats, L"With box: %2i\n\n", PlayerStats->WalkingSpeedWithBox); - fprintf(fpPlayerStats, "Range (x/y/z): %2i/%2i/%2i\n", PlayerStats->Range.x, - PlayerStats->Range.y, PlayerStats->Range.z); + fwprintf(fpPlayerStats, L"Range (x/y/z): %2i/%2i/%2i\n", PlayerStats->Range.x, + PlayerStats->Range.y, PlayerStats->Range.z); - fclose(fpPlayerStats); + fclose(fpPlayerStats); } void -PrintPlayerStats(player_stats *PlayerStats) -{ - player_stats Stats = *PlayerStats; - - u16 STRBase = Stats.STRBase; - u16 STRCur = Stats.STRCur; - u16 INTBase = Stats.INTBase; - u16 INTCur = Stats.INTCur; - u16 AGLBase = Stats.AGLBase; - u16 AGLCur = Stats.AGLCur; - - char STR_Buff = ' '; - char INT_Buff = ' '; - char AGL_Buff = ' '; - - if (STRCur > STRBase) - { - STR_Buff = '+'; - } - else if (STRCur < STRBase) - { - STR_Buff = '-'; - } - - if (INTCur > INTBase) - { - INT_Buff = '+'; - } - else if (INTCur < INTBase) - { - INT_Buff = '-'; - } - - if (AGLCur > AGLBase) - { - AGL_Buff = '+'; - } - else if (AGLCur < AGLBase) - { - AGL_Buff = '-'; - } - - sprintf(szBuffer, "\n\nPLAYER STATS:\n"); - WriteToBackBuffer(); - - sprintf(szBuffer, - "| HP | MP | RISK | %1cSTR | %1cINT | %1cAGL |" - " Range | | With Box | Running |\n", - STR_Buff, INT_Buff, AGL_Buff); - WriteToBackBuffer(); - - sprintf(szBuffer, - "|----------|----------|------|---------|---------|---------|" - "-------| Speed |----------|---------|\n"); - WriteToBackBuffer(); - - sprintf(szBuffer, - "| %3i/%3i | %3i/%3i | %4i | %3i/%3i | %3i/%3i | %3i/%3i |" - " %5i | | %8i | %7i |\n", // - Stats.HPCur, Stats.HPMax, // - Stats.MPCur, Stats.MPMax, // - Stats.Risk, // - STRCur, STRBase, // - INTCur, INTBase, // - AGLCur, AGLBase, - Stats.Range.x, // - Stats.WalkingSpeedWithBox, // - Stats.RunningSpeed); - WriteToBackBuffer(); -} +PrintPlayerStats(player_stats *PlayerStats) { + player_stats Stats = *PlayerStats; -void -PrintPlayerEffects(status_effects *PlayerEffects) -{ - status_effects Effects = *PlayerEffects; + u16 STRBase = Stats.STRBase; + u16 STRCur = Stats.STRCur; + u16 INTBase = Stats.INTBase; + u16 INTCur = Stats.INTCur; + u16 AGLBase = Stats.AGLBase; + u16 AGLCur = Stats.AGLCur; - sprintf(szBuffer, "\nSTATUS EFFECTS:\n"); - WriteToBackBuffer(); + char STR_Buff = ' '; + char INT_Buff = ' '; + char AGL_Buff = ' '; - u32 StatusEffectMask = Effects.EffectID; + if (STRCur > STRBase) + { + STR_Buff = '+'; + } + else if (STRCur < STRBase) + { + STR_Buff = '-'; + } - if (!StatusEffectMask) // if no Status Effects active, skip it - { - sprintf(szBuffer, "None\n"); - WriteToBackBuffer(); - } - else - { - int buff_counter = 0; - for (int i = 0; i < 32; ++i) + if (INTCur > INTBase) { - if (StatusEffectMasks[i] & StatusEffectMask) - { - sprintf(szBuffer, "%s%s%s", buff_counter ? "," : "", - buff_counter ? " " : "", StatusEffectNames[i]); - WriteToBackBuffer(); - buff_counter++; - } + INT_Buff = '+'; + } + else if (INTCur < INTBase) + { + INT_Buff = '-'; } - sprintf(szBuffer, "\n"); + + if (AGLCur > AGLBase) + { + AGL_Buff = '+'; + } + else if (AGLCur < AGLBase) + { + AGL_Buff = '-'; + } + + swprintf_s(szBuffer, _countof(szBuffer), L"\n\nPLAYER STATS:\n"); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), + L"| HP | MP | RISK | %1cSTR | %1cINT | %1cAGL |" + L" Range | | With Box | Running |\n", + STR_Buff, INT_Buff, AGL_Buff); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), + L"|----------|----------|------|---------|---------|---------|" + L"-------| Speed |----------|---------|\n"); + WriteToBackBuffer(); + + swprintf_s(szBuffer, _countof(szBuffer), + L"| %3i/%3i | %3i/%3i | %4i | %3i/%3i | %3i/%3i | %3i/%3i |" + L" %5i | | %8i | %7i |\n", // + Stats.HPCur, Stats.HPMax, // + Stats.MPCur, Stats.MPMax, // + Stats.Risk, // + STRCur, STRBase, // + INTCur, INTBase, // + AGLCur, AGLBase, + Stats.Range.x, // + Stats.WalkingSpeedWithBox, // + Stats.RunningSpeed); WriteToBackBuffer(); - } } void -WritePlayerEffects(status_effects *PlayerEffects) -{ - status_effects Effects = *PlayerEffects; +PrintPlayerEffects(status_effects *PlayerEffects) { + status_effects Effects = *PlayerEffects; - FILE *fpPlayerEffects = fopen("game_data/player/player_effects.txt", "w"); + swprintf_s(szBuffer, _countof(szBuffer), L"\nSTATUS EFFECTS:\n"); + WriteToBackBuffer(); - fprintf(fpPlayerEffects, "Status Effects\n\n"); + u32 StatusEffectMask = Effects.EffectID; - u32 StatusEffectMask = Effects.EffectID; + if (!StatusEffectMask) { // if no Status Effects active, skip it + swprintf_s(szBuffer, _countof(szBuffer), L"None\n"); + WriteToBackBuffer(); + } else { + int buff_counter = 0; + for (int i = 0; i < 32; ++i) { + if (StatusEffectMasks[i] & StatusEffectMask) { + swprintf_s(szBuffer, _countof(szBuffer), L"%s%s%s", buff_counter ? L"," : L"", + buff_counter ? L" " : L"", StatusEffectNames[i]); + WriteToBackBuffer(); + buff_counter++; + } + } + swprintf_s(szBuffer, _countof(szBuffer), L"\n"); + WriteToBackBuffer(); + } +} - if (!StatusEffectMask) // if no Status Effects active, skip it - { - fprintf(fpPlayerEffects, "No effects active\n"); - } - else - { - int buff_counter = 0; - for (int i = 0; i < 32; ++i) - { - if (StatusEffectMasks[i] & StatusEffectMask) - { - fprintf(fpPlayerEffects, "%s%s%s", buff_counter ? "," : "", - buff_counter ? " " : "", StatusEffectNames[i]); - buff_counter++; - } +void +WritePlayerEffects(status_effects *PlayerEffects) { + status_effects Effects = *PlayerEffects; + + FILE *fpPlayerEffects = _wfopen(L"game_data/player/player_effects.txt", L"w"); + + fwprintf(fpPlayerEffects, L"Status Effects\n\n"); + + u32 StatusEffectMask = Effects.EffectID; + + if (!StatusEffectMask) { // if no Status Effects active, skip it + fwprintf(fpPlayerEffects, L"No effects active\n"); + } else { + int buff_counter = 0; + for (int i = 0; i < 32; ++i) { + if (StatusEffectMasks[i] & StatusEffectMask) { + fwprintf(fpPlayerEffects, L"%s%s%s", buff_counter ? L"," : L"", + buff_counter ? L" " : L"", StatusEffectNames[i]); + buff_counter++; + } + } + fwprintf(fpPlayerEffects, L"\n"); } - fprintf(fpPlayerEffects, "\n"); - } - fclose(fpPlayerEffects); + fclose(fpPlayerEffects); } BOOL -CheckPlayerStats(player_stats *PlayerStats) -{ - - u16 HPCur = PlayerStats->HPCur; - u16 HPMax = PlayerStats->HPMax; - u16 MPCur = PlayerStats->MPCur; - u16 MPMax = PlayerStats->MPMax; - u16 Risk = PlayerStats->Risk; - u16 STRBase = PlayerStats->STRBase; - u16 INTBase = PlayerStats->INTBase; - u16 AGLBase = PlayerStats->AGLBase; - - // Check for invalid data - if (HPCur == 0 || HPCur > 999 || HPMax == 0 || HPMax > 999 || MPCur > 999 || - MPMax == 0 || MPMax > 999 || STRBase == 0 || STRBase > 999 || - INTBase == 0 || INTBase > 999 || AGLBase == 0 || AGLBase > 999 || - Risk > 100) - { - return FALSE; - } - - return TRUE; +CheckPlayerStats(player_stats *PlayerStats) { + + u16 HPCur = PlayerStats->HPCur; + u16 HPMax = PlayerStats->HPMax; + u16 MPCur = PlayerStats->MPCur; + u16 MPMax = PlayerStats->MPMax; + u16 Risk = PlayerStats->Risk; + u16 STRBase = PlayerStats->STRBase; + u16 INTBase = PlayerStats->INTBase; + u16 AGLBase = PlayerStats->AGLBase; + + // Check for invalid data + if (HPCur == 0 || HPCur > 999 || HPMax == 0 || HPMax > 999 || MPCur > 999 || + MPMax == 0 || MPMax > 999 || STRBase == 0 || STRBase > 999 || + INTBase == 0 || INTBase > 999 || AGLBase == 0 || AGLBase > 999 || + Risk > 100) + { + return FALSE; + } + + return TRUE; } BOOL -PlayerStatsChanged() -{ - usize DataSize = sizeof(player_stats); +PlayerStatsChanged() { + usize DataSize = sizeof(player_stats); - BOOL Result = DataChanged( - (void *) &statsPlayerPrev, (void *) &statsPlayerCur, DataSize); + BOOL Result = DataChanged( + (void *) &statsPlayerPrev, (void *) &statsPlayerCur, DataSize); - return Result; + return Result; } BOOL -PlayerEffectsChanged() -{ - usize DataSize = sizeof(status_effects); +PlayerEffectsChanged() { + usize DataSize = sizeof(status_effects); - BOOL Result = DataChanged( - (void *) &effectsPlayerPrev, (void *) &effectsPlayerCur, DataSize); + BOOL Result = DataChanged( + (void *) &effectsPlayerPrev, (void *) &effectsPlayerCur, DataSize); - return Result; + return Result; } u32 -ReadLastBossHealth(u16 *BossHP) -{ - u32 BytesRead = ReadGameMemory(processID, OFFSET_LAST_BOSS_HP_CUR, 2, BossHP); +ReadLastBossHealth(u16 *BossHP) { + u32 BytesRead = ReadGameMemory(processID, OFFSET_LAST_BOSS_HP_CUR, 2, BossHP); - return BytesRead; + return BytesRead; } void -LastBossHandleIt() -{ +LastBossHandleIt() { #ifdef DEBUG - sprintf(szBuffer, "\n= LAST BOSS FIGHT IS ON =\n"); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"\n= LAST BOSS FIGHT IS ON =\n"); + WriteToBackBuffer(); #endif - ReadLastBossHealth(&LastBossHP); + ReadLastBossHealth(&LastBossHP); - if (LastBossHP > 0) - { + if (LastBossHP > 0) { #ifdef DEBUG - sprintf(szBuffer, "Guildenstern's HP: %3i\n", LastBossHP); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Guildenstern's HP: %3i\n", LastBossHP); + WriteToBackBuffer(); #endif - } - else - { - ReadGameTime(&GameTimeRecord); - WriteGameTimeRecordToFile(&GameTimeRecord); + } else { + ReadGameTime(&GameTimeRecord); + WriteGameTimeRecordToFile(&GameTimeRecord); #ifdef DEBUG - sprintf(szBuffer, "Guildenstern is dead. Good Job!!!\n"); - WriteToBackBuffer(); - CopyFromBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"Guildenstern is dead. Good Job!!!\n"); + WriteToBackBuffer(); + CopyFromBackBuffer(); #endif - GameOver = TRUE; - } + GameOver = TRUE; + } } #endif + diff --git a/includes/vst_process.h b/includes/vst_process.h index 4737dd9..e2f879f 100644 --- a/includes/vst_process.h +++ b/includes/vst_process.h @@ -1,954 +1,824 @@ #ifndef _VST_PROCESS_H #define _VST_PROCESS_H -u32 PriorityClassValue[6] = { ABOVE_NORMAL_PRIORITY_CLASS, - BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS, IDLE_PRIORITY_CLASS, - NORMAL_PRIORITY_CLASS, REALTIME_PRIORITY_CLASS }; - -char *szPriorityClassName[6] = { "ABOVE_NORMAL_PRIORITY_CLASS", - "BELOW_NORMAL_PRIORITY_CLASS", "HIGH_PRIORITY_CLASS", "IDLE_PRIORITY_CLASS", - "NORMAL_PRIORITY_CLASS", "REALTIME_PRIORITY_CLASS" }; +u32 PriorityClassValue[6] = { + ABOVE_NORMAL_PRIORITY_CLASS, + BELOW_NORMAL_PRIORITY_CLASS, + HIGH_PRIORITY_CLASS, + IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS, + REALTIME_PRIORITY_CLASS }; + +wchar_t *szPriorityClassName[6] = { + L"ABOVE_NORMAL_PRIORITY_CLASS", + L"BELOW_NORMAL_PRIORITY_CLASS", + L"HIGH_PRIORITY_CLASS", + L"IDLE_PRIORITY_CLASS", + L"NORMAL_PRIORITY_CLASS", + L"REALTIME_PRIORITY_CLASS" }; void -ChangePageProtection(u32 processID, void *lpAddress, usize Size) -{ - u32 flNewProtect = PAGE_READWRITE; - u32 flOldProtect; +ChangePageProtection(u32 processID, void *lpAddress, usize Size) { + u32 flNewProtect = PAGE_READWRITE; + u32 flOldProtect; - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); + HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); - VirtualProtectEx(hProcess, lpAddress, Size, flNewProtect, &flOldProtect); + VirtualProtectEx(hProcess, lpAddress, Size, flNewProtect, &flOldProtect); } usize -GetRegionSize(u32 processID, const void *lpAddress) -{ - u32 DesiredAccess = PROCESS_QUERY_INFORMATION; - HANDLE hProcess = OpenProcess(DesiredAccess, FALSE, processID); - - if (hProcess) - { - MEMORY_BASIC_INFORMATION mbiBuffer = { 0 }; - if (VirtualQueryEx(hProcess, lpAddress, &mbiBuffer, sizeof(mbiBuffer))) - { - u32 Protect = mbiBuffer.Protect; - return mbiBuffer.RegionSize; +GetRegionSize(u32 processID, const void *lpAddress) { + u32 DesiredAccess = PROCESS_QUERY_INFORMATION; + HANDLE hProcess = OpenProcess(DesiredAccess, FALSE, processID); + + if (hProcess) { + MEMORY_BASIC_INFORMATION mbiBuffer = { 0 }; + if (VirtualQueryEx(hProcess, lpAddress, &mbiBuffer, sizeof(mbiBuffer))) { + u32 Protect = mbiBuffer.Protect; + return mbiBuffer.RegionSize; + } } - } - return -1; + return -1; } u64 -GetModuleDllBase(u32 processID, char *szModuleName) -{ - u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - HANDLE hProcess; - HMODULE hModule; - MODULEINFO modinfo = { 0 }; - u32 cbNeeded; +GetModuleDllBase(u32 processID, wchar_t *szModuleName) { + u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; + HANDLE hProcess; + HMODULE hModule; + MODULEINFO modinfo = { 0 }; + u32 cbNeeded; - u64 lpBaseOfDll; + u64 lpBaseOfDll; - hProcess = OpenProcess(DesiredAccess, FALSE, processID); + hProcess = OpenProcess(DesiredAccess, FALSE, processID); - if (NULL != hProcess) - { - if (EnumProcessModules(hProcess, &hModule, sizeof(hModule), &cbNeeded)) - { - if (GetModuleInformation(hProcess, hModule, &modinfo, sizeof(modinfo))) - { - lpBaseOfDll = (u64) modinfo.lpBaseOfDll; - } - else - { - fprintf(stderr, "ERROR: Couldn't read module info structure.\n"); - } + if (NULL != hProcess) { + if (EnumProcessModules(hProcess, &hModule, sizeof(hModule), &cbNeeded)) { + if (GetModuleInformation(hProcess, hModule, &modinfo, sizeof(modinfo))) { + lpBaseOfDll = (u64) modinfo.lpBaseOfDll; + } else { + fwprintf(stderr, L"ERROR: Couldn't read module info structure.\n"); + } + } + CloseHandle(hProcess); + } else { + fwprintf(stderr, L"ERROR: Couldn't open the process.\n"); } - CloseHandle(hProcess); - } - else - { - fprintf(stderr, "ERROR: Couldn't open the process.\n"); - } - return lpBaseOfDll; + return lpBaseOfDll; } u32 -FindProcessIdByName(u32 *ProcessesList, u32 ProcessesNumber, char *szModuleName) -{ - char szProcessName[MAX_PATH] = ""; - char lpFilename[MAX_PATH] = ""; - HMODULE hMods[1024]; - HANDLE hProcess; - char szBuffer[64]; - u32 cModules; - u32 processID = -1; - u32 DesiredAcces = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - - for (int i = 0; i < ProcessesNumber; i++) - { - - processID = *ProcessesList++; - - hProcess = OpenProcess(DesiredAcces, FALSE, processID); - - // Get the process name. - if (NULL != hProcess) - { - HMODULE hMod; - u32 cbNeeded; - - if (EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)) - { - for (int i = 0; i < (cbNeeded / sizeof(HMODULE)); ++i) - { - GetModuleBaseName(hProcess, hMods[i], szProcessName, - sizeof(szProcessName) / sizeof(char)); - // GetModuleFileNameEx(hProcess, hMods[i], lpFilename, MAX_PATH); - - // _tprintf("%d %s\n", processID, szProcessName); - // _tprintf("%d %s\n", processID, lpFilename); - - if (strcmp(szProcessName, szModuleName) == 0) - { - break; - } +FindProcessIdByName(u32 *ProcessesList, u32 ProcessesNumber, wchar_t *szModuleName) { + wchar_t szProcessName[MAX_PATH] = L""; + wchar_t lpFilename[MAX_PATH] = L""; + HMODULE hMods[1024]; + HANDLE hProcess; + char szBuffer[64]; + u32 cModules; + u32 processID = -1; + u32 DesiredAcces = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; + + for (int i = 0; i < ProcessesNumber; i++) { + processID = *ProcessesList++; + hProcess = OpenProcess(DesiredAcces, FALSE, processID); + + // Get the process name. + if (NULL != hProcess) { + HMODULE hMod; + u32 cbNeeded; + + if (EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)) { + for (int i = 0; i < (cbNeeded / sizeof(HMODULE)); ++i) { + GetModuleBaseNameW(hProcess, hMods[i], szProcessName, + _countof(szProcessName)); + + if (wcscmp(szProcessName, szModuleName) == 0) { + break; + } + } + } } - } } - } - if (hProcess) - { - CloseHandle(hProcess); - } + if (hProcess) { + CloseHandle(hProcess); + } - return processID; + return processID; } void -PrintProcessNameAndID(u32 processID) -{ - char szProcessName[MAX_PATH] = ""; +PrintProcessNameAndID(u32 processID) { + wchar_t szProcessName[MAX_PATH] = L""; - // Get a handle to the process. - HANDLE hProcess = OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + // Get a handle to the process. + HANDLE hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - // Get the process name. - if (NULL != hProcess) - { - HMODULE hMod; - u32 cbNeeded; + // Get the process name. + if (NULL != hProcess) { + HMODULE hMod; + u32 cbNeeded; - if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) - { - GetModuleBaseName( - hProcess, hMod, szProcessName, sizeof(szProcessName) / sizeof(char)); + if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) { + GetModuleBaseName( + hProcess, hMod, szProcessName, _countof(szProcessName)); + } } - } - // Print the process name and ID. - fprintf(stderr, "%s (PID: %u)\n", szProcessName, processID); + // Print the process name and ID. + fwprintf(stderr, L"%s (PID: %u)\n", szProcessName, processID); - // Release the handle to the process. - CloseHandle(hProcess); + // Release the handle to the process. + CloseHandle(hProcess); } u32 -ReadMemoryValue(u32 processID, usize offset, usize BytesToRead) -{ - u32 Value = -1; - // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); +ReadMemoryValue(u32 processID, usize offset, usize BytesToRead) { + u32 Value = -1; + // Get a handle to the process. + HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); - // Get the process name. - if (NULL != hProcess) - { - usize NumberOfBytesActuallyRead = -1; + // Get the process name. + if (NULL != hProcess) { + usize NumberOfBytesActuallyRead = -1; - if (ReadProcessMemory(hProcess, (const void *) offset, &Value, BytesToRead, - &NumberOfBytesActuallyRead)) - { - if (BytesToRead > NumberOfBytesActuallyRead) - { - fprintf(stderr, "ERROR: Not all bytes read from memory.\n"); - } - CloseHandle(hProcess); - } - else - { - fprintf(stderr, - "ERROR (ReadMemoryValue): Couldn't read from the process memory\n"); + if (ReadProcessMemory(hProcess, (const void *) offset, &Value, BytesToRead, + &NumberOfBytesActuallyRead)) { + if (BytesToRead > NumberOfBytesActuallyRead) { + fwprintf(stderr, L"ERROR: Not all bytes read from memory.\n"); + } + CloseHandle(hProcess); + } else { + fwprintf(stderr, + L"ERROR (ReadMemoryValue): Couldn't read from the process memory\n"); + } } - } - // CloseHandle(hProcess); - return Value; + // CloseHandle(hProcess); + return Value; } u8 -ReadByteFromProcessMemory(u32 processID, usize offset) -{ - u8 Value = 0; - // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); +ReadByteFromProcessMemory(u32 processID, usize offset) { + u8 Value = 0; + // Get a handle to the process. + HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); - // Get the process name. - if (NULL != hProcess) - { - usize NumberOfBytesActuallyRead = -1; - - if (ReadProcessMemory(hProcess, (const void *) offset, &Value, 1, - &NumberOfBytesActuallyRead)) - { - } - else - { - fprintf(stderr, - "ERROR (ReadMemoryValue): Couldn't read from the process memory\n"); + // Get the process name. + if (NULL != hProcess) { + usize NumberOfBytesActuallyRead = -1; + + if (ReadProcessMemory(hProcess, (const void *) offset, &Value, 1, + &NumberOfBytesActuallyRead)) { + } else { + fwprintf(stderr, + L"ERROR (ReadMemoryValue): Couldn't read from the process memory\n"); + } } - } - CloseHandle(hProcess); - return Value; + CloseHandle(hProcess); + return Value; } u32 -ReadMemoryValue2(u32 processID, usize offset, usize BytesToRead, void *Value) -{ - usize BytesActuallyRead = -1; - // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); +ReadMemoryValue2(u32 processID, usize offset, usize BytesToRead, void *Value) { + usize BytesActuallyRead = -1; + // Get a handle to the process. + HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); - // Get the process name. - if (NULL != hProcess) - { + // Get the process name. + if (NULL != hProcess) { + u8 *pvalue = Value; - u8 *pvalue = Value; - for (int i = 0; i < BytesToRead; ++i) - { - ReadProcessMemory(hProcess, (const void *) offset++, (void *) pvalue++, 1, - &BytesActuallyRead); + for (int i = 0; i < BytesToRead; ++i) { + ReadProcessMemory(hProcess, (const void *) offset++, (void *) pvalue++, 1, + &BytesActuallyRead); + } } - } - // CloseHandle(hProcess); - return BytesActuallyRead; + // CloseHandle(hProcess); + return BytesActuallyRead; } u32 -_GetProcessMemory(u32 processID, usize Offset, usize BytesToRead, void *Value) -{ - usize BytesActuallyRead = -1; - usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; +_GetProcessMemory(u32 processID, usize Offset, usize BytesToRead, void *Value) { + usize BytesActuallyRead = -1; + usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; - // Get a handle to the process. - fprintf(stderr, "GetProcessMemory - Offset: 0x%llx\n", FinalOffset); + // Get a handle to the process. + fwprintf(stderr, L"GetProcessMemory - Offset: 0x%llx\n", FinalOffset); - HANDLE hProcess = OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + HANDLE hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - // fprintf(stdout, "hProcess: %i\n", hProcess); + // fwprintf(stdout, L"hProcess: %i\n", hProcess); - // Get the process name. - if (NULL != hProcess) - { - if (ReadProcessMemory(hProcess, (const void *) FinalOffset, Value, - BytesToRead, &BytesActuallyRead)) - { - if (BytesToRead > BytesActuallyRead) - { - fprintf(stderr, - "ERROR (GetProcessMemory): Not all bytes read from memory.\n"); - } - CloseHandle(hProcess); - } - else - { - fprintf(stderr, - "ERROR (GetProcessMemory): Couldn't read from the process memory\n"); - exit(1); + // Get the process name. + if (NULL != hProcess) { + if (ReadProcessMemory(hProcess, (const void *) FinalOffset, Value, + BytesToRead, &BytesActuallyRead)) { + if (BytesToRead > BytesActuallyRead) { + fwprintf(stderr, + L"ERROR (GetProcessMemory): Not all bytes read from memory.\n"); + } + CloseHandle(hProcess); + } else { + fwprintf(stderr, + L"ERROR (GetProcessMemory): Couldn't read from the process memory\n"); + exit(1); + } } - } - // CloseHandle(hProcess); - return BytesActuallyRead; + // CloseHandle(hProcess); + return BytesActuallyRead; } void * -GetProcessMemory2(u32 processID, usize Offset, usize BytesToRead) -{ - usize BytesActuallyRead = -1; - usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; +GetProcessMemory2(u32 processID, usize Offset, usize BytesToRead) { + usize BytesActuallyRead = -1; + usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; - // Get a handle to the process. + // Get a handle to the process. - u8 *buffer = (u8 *) malloc(BytesToRead); - fprintf(stderr, "GetProcessMemory - Offset: 0x%llx\n", FinalOffset); + u8 *buffer = (u8 *) malloc(BytesToRead); + fwprintf(stderr, L"GetProcessMemory - Offset: 0x%llx\n", FinalOffset); - HANDLE hProcess = OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + HANDLE hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - // fprintf(stdout, "hProcess: %i\n", hProcess); + // fwprintf(stdout, L"hProcess: %i\n", hProcess); - // Get the process name. - if (NULL != hProcess) - { - if (ReadProcessMemory(hProcess, (const void *) FinalOffset, buffer, - BytesToRead, &BytesActuallyRead)) - { - if (BytesToRead > BytesActuallyRead) - { - fprintf(stderr, - "ERROR (GetProcessMemory): Not all bytes read from memory.\n"); - } - CloseHandle(hProcess); - } - else - { - fprintf(stderr, - "ERROR (GetProcessMemory): Couldn't read from the process memory\n"); - exit(1); + // Get the process name. + if (NULL != hProcess) { + if (ReadProcessMemory(hProcess, (const void *) FinalOffset, buffer, + BytesToRead, &BytesActuallyRead)) { + if (BytesToRead > BytesActuallyRead) { + fwprintf(stderr, + L"ERROR (GetProcessMemory): Not all bytes read from memory.\n"); + } + CloseHandle(hProcess); + } else { + fwprintf(stderr, + L"ERROR (GetProcessMemory): Couldn't read from the process memory\n"); + exit(1); + } } - } - // CloseHandle(hProcess); - return buffer; + // CloseHandle(hProcess); + return buffer; } void PrintMemoryValue( - u32 processID, usize offset, usize BytesToRead, char *szDescription) -{ - char szBuffer[1024] = ""; - - // Make sure to change Value size depending from the BytesToRead - i16 Value = -1; - - if (_GetProcessMemory(processID, offset, BytesToRead, &Value)) - { - fprintf(stdout, "Value of %s: %d\n", szDescription, Value); - } - else - { - fprintf(stderr, "ERROR (PrintMemoryValue): Couldn't read the Value\n"); - } + u32 processID, usize offset, usize BytesToRead, wchar_t *szDescription) { + //char szBuffer[1024] = ""; not used??? + + // Make sure to change Value size depending from the BytesToRead + i16 Value = -1; + + if (_GetProcessMemory(processID, offset, BytesToRead, &Value)) { + fwprintf(stdout, L"Value of %s: %d\n", szDescription, Value); + } else { + fwprintf(stderr, L"ERROR (PrintMemoryValue): Couldn't read the Value\n"); + } } void -PrintProcessInfo(u32 processID) -{ - u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - HANDLE hProcess; - HMODULE hModule; - MODULEINFO modinfo; - u32 cbNeeded; - - hProcess = OpenProcess(DesiredAccess, FALSE, processID); +PrintProcessInfo(u32 processID) { + u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; + HANDLE hProcess; + HMODULE hModule; + MODULEINFO modinfo; + u32 cbNeeded; - if (NULL != hProcess) - { - if (EnumProcessModules(hProcess, &hModule, sizeof(hModule), &cbNeeded)) - { - if (GetModuleInformation(hProcess, hModule, &modinfo, sizeof(modinfo))) - { - void *lpBaseOfDll = modinfo.lpBaseOfDll; - u32 SizeOfImage = modinfo.SizeOfImage; - void *EntryPoint = modinfo.EntryPoint; - - fprintf(stdout, "Base of DLL: %p\n", lpBaseOfDll); - fprintf(stdout, "Size of Image: %d\n", SizeOfImage); - fprintf(stdout, "Entry Point: %p\n", EntryPoint); - } - else - { - fprintf(stderr, - "ERROR (PrintProcessInfo): Couldn't read module info structure.\n"); - } + hProcess = OpenProcess(DesiredAccess, FALSE, processID); + + if (NULL != hProcess) { + if (EnumProcessModules(hProcess, &hModule, sizeof(hModule), &cbNeeded)) { + if (GetModuleInformation(hProcess, hModule, &modinfo, sizeof(modinfo))) { + void *lpBaseOfDll = modinfo.lpBaseOfDll; + u32 SizeOfImage = modinfo.SizeOfImage; + void *EntryPoint = modinfo.EntryPoint; + + fwprintf(stdout, L"Base of DLL: %p\n", lpBaseOfDll); + fwprintf(stdout, L"Size of Image: %d\n", SizeOfImage); + fwprintf(stdout, L"Entry Point: %p\n", EntryPoint); + } else { + fwprintf(stderr, + L"ERROR (PrintProcessInfo): Couldn't read module info structure.\n"); + } + } + CloseHandle(hProcess); + } else { + fwprintf(stderr, L"ERROR (PrintProcessInfo): Couldn't open the process.\n"); } - CloseHandle(hProcess); - } - else - { - fprintf(stderr, "ERROR (PrintProcessInfo): Couldn't open the process.\n"); - } } void -PrintPriorityClass(u32 processID) -{ - u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - u32 PriorityClass; - HANDLE hProcess; +PrintPriorityClass(u32 processID) { + u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; + u32 PriorityClass; + HANDLE hProcess; - hProcess = OpenProcess(DesiredAccess, FALSE, processID); + hProcess = OpenProcess(DesiredAccess, FALSE, processID); - PriorityClass = GetPriorityClass(hProcess); + PriorityClass = GetPriorityClass(hProcess); - for (int i = 0; i < 6; i++) - { - if (PriorityClass == PriorityClassValue[i]) - { - fprintf( - stdout, "Process priority class is: %s\n", szPriorityClassName[i]); - break; + for (int i = 0; i < 6; i++) { + if (PriorityClass == PriorityClassValue[i]) { + fwprintf( + stdout, L"Process priority class is: %s\n", szPriorityClassName[i]); + break; + } } - } - CloseHandle(hProcess); + CloseHandle(hProcess); } void -PrintModuleFileName(u32 processID) -{ - fprintf(stdout, "Process ID: %d\n", processID); - - HANDLE hProcess; - HMODULE hModules[32]; - HMODULE hModule; - char lpFilename[MAX_PATH] = ""; - char szBaseName[MAX_PATH] = ""; - u32 cbNeeded; - u32 DesiredAccess = PROCESS_VM_READ | PROCESS_QUERY_INFORMATION; +PrintModuleFileName(u32 processID) { + fwprintf(stdout, L"Process ID: %d\n", processID); + + HANDLE hProcess; + HMODULE hModules[32]; + HMODULE hModule; + wchar_t lpFilename[MAX_PATH] = L""; + wchar_t szBaseName[MAX_PATH] = L""; + u32 cbNeeded; + u32 DesiredAccess = PROCESS_VM_READ | PROCESS_QUERY_INFORMATION; - hProcess = OpenProcess(DesiredAccess, FALSE, processID); + hProcess = OpenProcess(DesiredAccess, FALSE, processID); - if (NULL != hProcess) - { - if (EnumProcessModules(hProcess, hModules, sizeof(hModules), &cbNeeded)) - { - GetModuleBaseName( - hProcess, hModules[0], szBaseName, sizeof(szBaseName) / sizeof(char)); + if (NULL != hProcess) { + if (EnumProcessModules(hProcess, hModules, sizeof(hModules), &cbNeeded)) { + GetModuleBaseName( + hProcess, hModules[0], szBaseName, _countof(szBaseName)); - GetModuleFileNameEx(hProcess, hModules[0], lpFilename, MAX_PATH); - fprintf(stdout, "Base name: %s File name: %s\n", szBaseName, lpFilename); + GetModuleFileNameEx(hProcess, hModules[0], lpFilename, MAX_PATH); + fwprintf(stdout, L"Base name: %s File name: %s\n", szBaseName, lpFilename); + } + CloseHandle(hProcess); } - CloseHandle(hProcess); - } } void -PrintProcessVersion(u32 processID) -{ - u32 Version = GetProcessVersion(processID); +PrintProcessVersion(u32 processID) { + u32 Version = GetProcessVersion(processID); - u16 major, minor; + u16 major, minor; - major = (Version & 0xFFFF0000) >> 16; - minor = Version & 0x0000FFFF; + major = (Version & 0xffff0000) >> 16; + minor = Version & 0x0000ffff; - fprintf(stdout, "Version: %i.%i\n", major, minor); + fwprintf(stdout, L"Version: %i.%i\n", major, minor); } BOOL -GetProcessIdFromName(u32 *processID, char *szModuleName) -{ - HANDLE hProcess = CreateToolhelp32Snapshot( - TH32CS_SNAPPROCESS | TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, 0); - if (hProcess) - { - PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; - Process32First(hProcess, &pe32); - - do - { - if ((strcmp(pe32.szExeFile, szModuleName) == 0)) - { +GetProcessIdFromName(u32 *processID, wchar_t *szModuleName) { + HANDLE hProcess = CreateToolhelp32Snapshot( + TH32CS_SNAPPROCESS | TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, 0); + if (hProcess) { + PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; + Process32First(hProcess, &pe32); + + do { + if ((wcscmp(pe32.szExeFile, szModuleName) == 0)) { #ifdef DEBUG - fprintf(stdout, "Found it!!! The PID you're looking for is %i\n", - pe32.th32ProcessID); + fwprintf(stdout, L"Found it!!! The PID you're looking for is %i\n", + pe32.th32ProcessID); #endif - *processID = pe32.th32ProcessID; + *processID = pe32.th32ProcessID; - MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; - Module32First(hProcess, &me32); + MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; + Module32First(hProcess, &me32); #ifdef DEBUG - fprintf(stdout, "Module base: %p\n", me32.modBaseAddr); + fwprintf(stdout, L"Module base: %p\n", me32.modBaseAddr); #endif - return TRUE; - } + return TRUE; + } - MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; - HANDLE hModuleSnap = CreateToolhelp32Snapshot( - TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pe32.th32ProcessID); + MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; + HANDLE hModuleSnap = CreateToolhelp32Snapshot( + TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pe32.th32ProcessID); - do - { - // fprintf(stdout, "Module name: %s\n", me32.szModule); - if ((strcmp(me32.szModule, szModuleName) == 0)) - { - fprintf(stdout, "Found it!!! The PID you're looking for is %i\n", - pe32.th32ProcessID); + do { + // fwprintf(stdout, L"Module name: %s\n", me32.szModule); + if ((wcscmp(me32.szModule, szModuleName) == 0)) { + fwprintf(stdout, L"Found it!!! The PID you're looking for is %i\n", + pe32.th32ProcessID); - fprintf(stdout, "Module base: %p\n", me32.modBaseAddr); + fwprintf(stdout, L"Module base: %p\n", me32.modBaseAddr); - *processID = pe32.th32ProcessID; - return TRUE; - } - } while (Module32Next(hModuleSnap, &me32)); - } while (Process32Next(hProcess, &pe32)); + *processID = pe32.th32ProcessID; + return TRUE; + } + } while (Module32Next(hModuleSnap, &me32)); + } while (Process32Next(hProcess, &pe32)); - CloseHandle(hProcess); - } - return FALSE; + CloseHandle(hProcess); + } + return FALSE; } BOOL -GetProcessIdFromName2(u32 *processID, char *szModuleName) -{ - HANDLE hProcess = CreateToolhelp32Snapshot( - TH32CS_SNAPPROCESS | TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, 0); - if (hProcess) - { - PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; - Process32First(hProcess, &pe32); - - do - { - if ((strcmp(pe32.szExeFile, szModuleName) == 0)) - { - fprintf(stdout, "Found it!!! The PID you're looking for is %i\n", - pe32.th32ProcessID); - *processID = pe32.th32ProcessID; - - MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; - Module32First(hProcess, &me32); - - fprintf(stdout, "Module base: %p\n", me32.modBaseAddr); - - HANDLE hModuleSnap = CreateToolhelp32Snapshot( - TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pe32.th32ProcessID); - do - { - // fprintf(stdout, "Module name: %s\n", me32.szModule); - if ((strcmp(me32.szModule, szModuleName) == 0)) - { - fprintf(stdout, "Found it!!! The PID you're looking for is %i\n", - pe32.th32ProcessID); - - fprintf(stdout, "Module base: %p\n", me32.modBaseAddr); - } - } while (Module32Next(hModuleSnap, &me32)); - } - - } while (Process32Next(hProcess, &pe32)); +GetProcessIdFromName2(u32 *processID, wchar_t *szModuleName) { + HANDLE hProcess = CreateToolhelp32Snapshot( + TH32CS_SNAPPROCESS | TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, 0); + if (hProcess) { + PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; + Process32First(hProcess, &pe32); + + do { + if ((wcscmp(pe32.szExeFile, szModuleName) == 0)) { + fwprintf(stdout, L"Found it!!! The PID you're looking for is %i\n", + pe32.th32ProcessID); + *processID = pe32.th32ProcessID; + + MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; + Module32First(hProcess, &me32); + + fwprintf(stdout, L"Module base: %p\n", me32.modBaseAddr); + + HANDLE hModuleSnap = CreateToolhelp32Snapshot( + TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pe32.th32ProcessID); + do { + // fwprintf(stdout, L"Module name: %s\n", me32.szModule); + if ((wcscmp(me32.szModule, szModuleName) == 0)) { + fwprintf(stdout, L"Found it!!! The PID you're looking for is %i\n", + pe32.th32ProcessID); + + fwprintf(stdout, L"Module base: %p\n", me32.modBaseAddr); + } + } while (Module32Next(hModuleSnap, &me32)); + } + } while (Process32Next(hProcess, &pe32)); - CloseHandle(hProcess); - } - return FALSE; + CloseHandle(hProcess); + } + return FALSE; } u32 -ReadGameMemory(u32 processID, usize Offset, usize BytesToRead, void *Value) -{ - usize BytesActuallyRead = -1; - usize FinalOffset = - (usize)((usize) emuBaseAddress + (usize)(Offset & 0x01fffff)); +ReadGameMemory(u32 processID, usize Offset, usize BytesToRead, void *Value) { + usize BytesActuallyRead = -1; + usize FinalOffset = + (usize)((usize) emuBaseAddress + (usize)(Offset & 0x01fffff)); - Toolhelp32ReadProcessMemory( - processID, (usize *) FinalOffset, Value, BytesToRead, &BytesActuallyRead); + Toolhelp32ReadProcessMemory( + processID, (usize *) FinalOffset, Value, BytesToRead, &BytesActuallyRead); - return BytesActuallyRead; + return BytesActuallyRead; } void * -ReadGameMemory2(u32 processID, usize Offset, usize BytesToRead) -{ +ReadGameMemory2(u32 processID, usize Offset, usize BytesToRead) { - usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; + usize FinalOffset = (usize) emuBaseAddress + (usize) Offset; - void *pValue = (void *) malloc(BytesToRead); + void *pValue = (void *) malloc(BytesToRead); - HANDLE hProcess = OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + HANDLE hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - if (NULL != hProcess) - { - ReadProcessMemory( - hProcess, (const void *) FinalOffset, pValue, BytesToRead, NULL); - } + if (NULL != hProcess) { + ReadProcessMemory( + hProcess, (const void *) FinalOffset, pValue, BytesToRead, NULL); + } - // CloseHandle(hProcess); + // CloseHandle(hProcess); - return pValue; + return pValue; } void PrintHeapList(processID) { - fprintf(stdout, "Looking for a heap list...\n"); - - HEAPLIST32 hl32 = { sizeof(HEAPLIST32) }; - - HANDLE hHeapSnap = CreateToolhelp32Snapshot(TH32CS_SNAPHEAPLIST, processID); + fwprintf(stdout, L"Looking for a heap list...\n"); - if (Heap32ListFirst(hHeapSnap, &hl32)) - { - fprintf(stdout, "Heap list found!!!\n"); - do - { - HEAPENTRY32 he32 = { sizeof(HEAPENTRY32) }; + HEAPLIST32 hl32 = { sizeof(HEAPLIST32) }; - if (Heap32First(&he32, processID, hl32.th32HeapID)) - { + HANDLE hHeapSnap = CreateToolhelp32Snapshot(TH32CS_SNAPHEAPLIST, processID); - do - { - fprintf(stdout, "Block size: %I64i\n", he32.dwBlockSize); + if (Heap32ListFirst(hHeapSnap, &hl32)) { + fwprintf(stdout, L"Heap list found!!!\n"); + do { + HEAPENTRY32 he32 = { sizeof(HEAPENTRY32) }; - he32.dwSize = sizeof(HEAPENTRY32); - } while (Heap32Next(&he32)); - } - hl32.dwSize = sizeof(HEAPLIST32); + if (Heap32First(&he32, processID, hl32.th32HeapID)) { + do { + fwprintf(stdout, L"Block size: %I64i\n", he32.dwBlockSize); - } while (Heap32ListNext(hHeapSnap, &hl32)); - } + he32.dwSize = sizeof(HEAPENTRY32); + } while (Heap32Next(&he32)); + } + hl32.dwSize = sizeof(HEAPLIST32); + } while (Heap32ListNext(hHeapSnap, &hl32)); + } - CloseHandle(hHeapSnap); + CloseHandle(hHeapSnap); } -BOOL + BOOL ListProcessModules(u32 dwPID) { - HANDLE hModuleSnap = INVALID_HANDLE_VALUE; - MODULEENTRY32 me32; - - // Take a snapshot of all modules in the specified process. - hModuleSnap = - CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPID); - if (hModuleSnap == INVALID_HANDLE_VALUE) - { - // printError("CreateToolhelp32Snapshot (of modules)"); - return (FALSE); - } - me32.dwSize = sizeof(MODULEENTRY32); - - // Retrieve information about the first module, - // and exit if unsuccessful - if (!Module32First(hModuleSnap, &me32)) - { - // printError("Module32First"); // Show cause of failure - CloseHandle(hModuleSnap); // Must clean up the snapshot object! - return (FALSE); - } - - // Now walk the module list of the process, - // and display information about each module - do - { - if (strcmp(me32.szModule, szModuleName) == 0) - { - - fprintf(stdout, "\n\n MODULE NAME: %s\n", me32.szModule); - fprintf(stdout, " executable = %s\n", me32.szExePath); - fprintf(stdout, " process ID = 0x%08X\n", me32.th32ProcessID); - fprintf(stdout, " ref count (g) = 0x%04X\n", me32.GlblcntUsage); - fprintf(stdout, " ref count (p) = 0x%04X\n", me32.ProccntUsage); - fprintf(stdout, " base address = 0x%p\n", me32.modBaseAddr); - fprintf(stdout, " base size = %d\n", me32.modBaseSize); + HANDLE hModuleSnap = INVALID_HANDLE_VALUE; + MODULEENTRY32 me32; + + // Take a snapshot of all modules in the specified process. + hModuleSnap = + CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPID); + if (hModuleSnap == INVALID_HANDLE_VALUE) { + // printError("CreateToolhelp32Snapshot (of modules)"); + return (FALSE); + } + me32.dwSize = sizeof(MODULEENTRY32); + + // Retrieve information about the first module, + // and exit if unsuccessful + if (!Module32First(hModuleSnap, &me32)) { + // printError("Module32First"); // Show cause of failure + CloseHandle(hModuleSnap); // Must clean up the snapshot object! + return (FALSE); } - } while (Module32Next(hModuleSnap, &me32)); + // Now walk the module list of the process, + // and display information about each module + do { + if (wcscmp(me32.szModule, szModuleName) == 0) { + + fwprintf(stdout, L"\n\n MODULE NAME: %s\n", me32.szModule); + fwprintf(stdout, L" executable = %s\n", me32.szExePath); + fwprintf(stdout, L" process ID = 0x%08X\n", me32.th32ProcessID); + fwprintf(stdout, L" ref count (g) = 0x%04X\n", me32.GlblcntUsage); + fwprintf(stdout, L" ref count (p) = 0x%04X\n", me32.ProccntUsage); + fwprintf(stdout, L" base address = 0x%p\n", me32.modBaseAddr); + fwprintf(stdout, L" base size = %d\n", me32.modBaseSize); + } + } while (Module32Next(hModuleSnap, &me32)); - fprintf(stdout, "\n"); + fwprintf(stdout, L"\n"); - // Do not forget to clean up the snapshot object. - CloseHandle(hModuleSnap); - return (TRUE); + // Do not forget to clean up the snapshot object. + CloseHandle(hModuleSnap); + return (TRUE); } u64 -FindDllAddress(u32 dwPID, char *szModulName) -{ - HANDLE hModuleSnap = INVALID_HANDLE_VALUE; - MODULEENTRY32 me32; - - // Take a snapshot of all modules in the specified process. - hModuleSnap = - CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPID); - if (hModuleSnap == INVALID_HANDLE_VALUE) - { - // printError("CreateToolhelp32Snapshot (of modules)"); - return (FALSE); - } - me32.dwSize = sizeof(MODULEENTRY32); - - // Retrieve information about the first module, - // and exit if unsuccessful - if (!Module32First(hModuleSnap, &me32)) - { - // printError("Module32First"); // Show cause of failure - CloseHandle(hModuleSnap); // Must clean up the snapshot object! - return (FALSE); - } - - // Now walk the module list of the process, - // and display information about each module - do - { - if (strcmp(szModuleName, me32.szModule) == 0) - { - return (u64) me32.modBaseAddr; +FindDllAddress(u32 dwPID, char *szModulName) { + HANDLE hModuleSnap = INVALID_HANDLE_VALUE; + MODULEENTRY32 me32; + + // Take a snapshot of all modules in the specified process. + hModuleSnap = + CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPID); + if (hModuleSnap == INVALID_HANDLE_VALUE) { + // printError("CreateToolhelp32Snapshot (of modules)"); + return (FALSE); + } + me32.dwSize = sizeof(MODULEENTRY32); + + // Retrieve information about the first module, + // and exit if unsuccessful + if (!Module32First(hModuleSnap, &me32)) { + // printError("Module32First"); // Show cause of failure + CloseHandle(hModuleSnap); // Must clean up the snapshot object! + return (FALSE); } - // _tprintf("\n\n MODULE NAME: %s\n", me32.szModule); - // _tprintf(" executable = %s\n", me32.szExePath); - // _tprintf(" process ID = 0x%08X\n", me32.th32ProcessID); - // _tprintf(" ref count (g) = 0x%04X\n", me32.GlblcntUsage); - // _tprintf(" ref count (p) = 0x%04X\n", me32.ProccntUsage); - // _tprintf(" base address = 0x%p\n", me32.modBaseAddr); - // _tprintf(" base size = %d\n", me32.modBaseSize); - - } while (Module32Next(hModuleSnap, &me32)); - // Do not forget to clean up the snapshot object. - CloseHandle(hModuleSnap); - return (0); + // Now walk the module list of the process, + // and display information about each module + do { + if (wcscmp(szModuleName, me32.szModule) == 0) { + return (u64) me32.modBaseAddr; + } + // _tprintf("\n\n MODULE NAME: %s\n", me32.szModule); + // _tprintf(" executable = %s\n", me32.szExePath); + // _tprintf(" process ID = 0x%08X\n", me32.th32ProcessID); + // _tprintf(" ref count (g) = 0x%04X\n", me32.GlblcntUsage); + // _tprintf(" ref count (p) = 0x%04X\n", me32.ProccntUsage); + // _tprintf(" base address = 0x%p\n", me32.modBaseAddr); + // _tprintf(" base size = %d\n", me32.modBaseSize); + } while (Module32Next(hModuleSnap, &me32)); + + // Do not forget to clean up the snapshot object. + CloseHandle(hModuleSnap); + return (0); } BOOL -ListProcessThreads(u32 dwPID) -{ - HANDLE hThreadSnap = INVALID_HANDLE_VALUE; - THREADENTRY32 te32 = { sizeof(THREADENTRY32) }; - - // Take a snapshot of all modules in the specified process. - hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); - if (hThreadSnap == INVALID_HANDLE_VALUE) - { - // printError("CreateToolhelp32Snapshot (of modules)"); - return (FALSE); - } - - // Retrieve information about the first module, - // and exit if unsuccessful - if (!Thread32First(hThreadSnap, &te32)) - { - // printError("Module32First"); // Show cause of failure - CloseHandle(hThreadSnap); // Must clean up the snapshot object! - return (FALSE); - } - - // Now walk the module list of the process, - // and display information about each module - do - { - if (te32.th32OwnerProcessID == dwPID) - { +ListProcessThreads(u32 dwPID) { + HANDLE hThreadSnap = INVALID_HANDLE_VALUE; + THREADENTRY32 te32 = { sizeof(THREADENTRY32) }; + + // Take a snapshot of all modules in the specified process. + hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (hThreadSnap == INVALID_HANDLE_VALUE) { + // printError("CreateToolhelp32Snapshot (of modules)"); + return (FALSE); + } - fprintf(stdout, "\n\n THREAD ID: %i", te32.th32ThreadID); - fprintf(stdout, "\n dwSize: %i", te32.dwSize); - fprintf(stdout, "\n Base Priority = %i", te32.tpBasePri); - fprintf(stdout, "\n Delta Priority = %i", te32.tpDeltaPri); + // Retrieve information about the first module, + // and exit if unsuccessful + if (!Thread32First(hThreadSnap, &te32)) { + // printError("Module32First"); // Show cause of failure + CloseHandle(hThreadSnap); // Must clean up the snapshot object! + return (FALSE); } - } while (Thread32Next(hThreadSnap, &te32)); + // Now walk the module list of the process, + // and display information about each module + do { + if (te32.th32OwnerProcessID == dwPID) { + fwprintf(stdout, L"\n\n THREAD ID: %i", te32.th32ThreadID); + fwprintf(stdout, L"\n dwSize: %i", te32.dwSize); + fwprintf(stdout, L"\n Base Priority = %i", te32.tpBasePri); + fwprintf(stdout, L"\n Delta Priority = %i", te32.tpDeltaPri); + } + } while (Thread32Next(hThreadSnap, &te32)); - fprintf(stdout, "\n"); + fwprintf(stdout, L"\n"); - // Do not forget to clean up the snapshot object. - CloseHandle(hThreadSnap); - return (TRUE); + // Do not forget to clean up the snapshot object. + CloseHandle(hThreadSnap); + return (TRUE); } HANDLE -GetProcessHandle(char *ProcessName, u32 *ReturnedProcessId) -{ - PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; - HANDLE hSnap; +GetProcessHandle(wchar_t *ProcessName, u32 *ReturnedProcessId) { + PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) }; + HANDLE hSnap; - // pe->dwSize = sizeof(PROCESSENTRY32W); - hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + // pe->dwSize = sizeof(PROCESSENTRY32W); + hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hSnap == INVALID_HANDLE_VALUE) - { - return 0; - } + if (hSnap == INVALID_HANDLE_VALUE) { + return 0; + } - BOOL bProcess = Process32First(hSnap, &pe32); - while (bProcess) - { - if (strcmp(pe32.szExeFile, ProcessName) == 0) + BOOL bProcess = Process32First(hSnap, &pe32); + while (bProcess) { - HANDLE ProcessHandle = - OpenProcess(PROCESS_ALL_ACCESS, 0, pe32.th32ProcessID); + if (wcscmp(pe32.szExeFile, ProcessName) == 0) { + HANDLE ProcessHandle = + OpenProcess(PROCESS_ALL_ACCESS, 0, pe32.th32ProcessID); - if (ReturnedProcessId) - *ReturnedProcessId = pe32.th32ProcessID; + if (ReturnedProcessId) *ReturnedProcessId = pe32.th32ProcessID; - CloseHandle(hSnap); + CloseHandle(hSnap); - return ProcessHandle; - } + return ProcessHandle; + } - bProcess = Process32Next(hSnap, &pe32); - } + bProcess = Process32Next(hSnap, &pe32); + } - CloseHandle(hSnap); + CloseHandle(hSnap); - return 0; + return 0; } usize -GetModuleBase(char *ModuleName, u32 ProcessId) -{ - fprintf(stdout, "Searching for %s\n", ModuleName); +GetModuleBase(wchar_t *ModuleName, u32 ProcessId) { + fwprintf(stdout, L"Searching for %s\n", ModuleName); - MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; + MODULEENTRY32 me32 = { sizeof(MODULEENTRY32) }; - HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE32, ProcessId); + HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE32, ProcessId); - if (hSnap == INVALID_HANDLE_VALUE) - { - return 0; - } - - BOOL bModule = Module32First(hSnap, &me32); - while (bModule) - { - if (!ModuleName || strcmp(me32.szModule, ModuleName) == 0) - { - fprintf(stdout, "I found the DLL!!!\n"); - CloseHandle(hSnap); - return (usize) me32.modBaseAddr; + if (hSnap == INVALID_HANDLE_VALUE) { + return 0; } - bModule = Module32Next(hSnap, &me32); - } + BOOL bModule = Module32First(hSnap, &me32); + while (bModule) { + if (!ModuleName || wcscmp(me32.szModule, ModuleName) == 0) { + fwprintf(stdout, L"I found the DLL!!!\n"); + CloseHandle(hSnap); + return (usize) me32.modBaseAddr; + } + + bModule = Module32Next(hSnap, &me32); + } - CloseHandle(hSnap); + CloseHandle(hSnap); - return 0; + return 0; } HRSRC -GetModuleResource(HANDLE RemoteProcessHandle, char *szResourceName) -{ - HRSRC hResource = - FindResource(RemoteProcessHandle, szResourceName, RT_RCDATA); +GetModuleResource(HANDLE RemoteProcessHandle, wchar_t *szResourceName) { + HRSRC hResource = + FindResource(RemoteProcessHandle, szResourceName, RT_RCDATA); - return hResource; + return hResource; } void -EnumProcessModules2(u32 processID) -{ - HANDLE hProcess; - u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; +EnumProcessModules2(u32 processID) { + HANDLE hProcess; + u32 DesiredAccess = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ; - hProcess = OpenProcess(DesiredAccess, FALSE, processID); + hProcess = OpenProcess(DesiredAccess, FALSE, processID); - HMODULE hmArray[256]; - u32 cb = sizeof(hmArray); - u32 cbNeeded; - u32 dwFilterFlag = LIST_MODULES_32BIT | LIST_MODULES_64BIT; - char szModulName[MAX_PATH]; + HMODULE hmArray[256]; + u32 cb = sizeof(hmArray); + u32 cbNeeded; + u32 dwFilterFlag = LIST_MODULES_32BIT | LIST_MODULES_64BIT; + wchar_t szModulName[MAX_PATH]; - EnumProcessModulesEx(hProcess, hmArray, cb, &cbNeeded, dwFilterFlag); + EnumProcessModulesEx(hProcess, hmArray, cb, &cbNeeded, dwFilterFlag); - fprintf(stdout, "cb: %i, cbNeeded: %i", cb, cbNeeded); + fwprintf(stdout, L"cb: %i, cbNeeded: %i", cb, cbNeeded); - int cbSize = cbNeeded / sizeof(HMODULE); + int cbSize = cbNeeded / sizeof(HMODULE); - for (int i = 0; i < cbSize; ++i) - { - GetModuleFileNameEx(hProcess, hmArray[i], szModulName, MAX_PATH); - fprintf(stdout, "Module name: %s\n", szModuleName); - } + for (int i = 0; i < cbSize; ++i) { + GetModuleFileNameEx(hProcess, hmArray[i], szModulName, MAX_PATH); + fwprintf(stdout, L"Module name: %s\n", szModuleName); + } } BOOL -EnableDebugPrivilege(void) -{ - // Get the privilege value for `SeDebugPrivilege` - LUID luidDebugPrivilege; - LUID luidProfilePrivilege; - - if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luidDebugPrivilege)) - { - ErrorExit("LookupPrivilegeValue"); - } - - // Fill up the TOKEN_PRIVILEGES structure - TOKEN_PRIVILEGES tkPrivs; - - tkPrivs.PrivilegeCount = 1; // Modify 2 privileges - tkPrivs.Privileges[0].Luid = - luidDebugPrivilege; // we want to modify `SeDebugPrivilege` - tkPrivs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // enable it - - HANDLE hCurrentProcess = GetCurrentProcess(); - HANDLE hProcessToken; - - if (!OpenProcessToken( - hCurrentProcess, TOKEN_ADJUST_PRIVILEGES, &hProcessToken)) - { - ErrorExit("OpenProcessToken"); - } - - // Let's enable Debug privileges in the token - if (!AdjustTokenPrivileges(hProcessToken, FALSE, &tkPrivs, 0, NULL, NULL)) - { - ErrorExit("AdjustTokenPrivileges"); - } - - return TRUE; +EnableDebugPrivilege(void) { + // Get the privilege value for `SeDebugPrivilege` + LUID luidDebugPrivilege; + LUID luidProfilePrivilege; + + if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luidDebugPrivilege)) { + ErrorExit(L"LookupPrivilegeValue"); + } + + // Fill up the TOKEN_PRIVILEGES structure + TOKEN_PRIVILEGES tkPrivs; + + tkPrivs.PrivilegeCount = 1; // Modify 2 privileges + tkPrivs.Privileges[0].Luid = + luidDebugPrivilege; // we want to modify `SeDebugPrivilege` + tkPrivs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // enable it + + HANDLE hCurrentProcess = GetCurrentProcess(); + HANDLE hProcessToken; + + if (!OpenProcessToken( + hCurrentProcess, TOKEN_ADJUST_PRIVILEGES, &hProcessToken)) { + ErrorExit(L"OpenProcessToken"); + } + + // Let's enable Debug privileges in the token + if (!AdjustTokenPrivileges(hProcessToken, FALSE, &tkPrivs, 0, NULL, NULL)) { + ErrorExit(L"AdjustTokenPrivileges"); + } + + return TRUE; } u8 * -GetAddressOfData(DWORD pid, const u8 *data, usize len, u8 maxAttempts) -{ - HANDLE process = - OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, pid); - if (process) - { - SYSTEM_INFO si; - GetSystemInfo(&si); - - MEMORY_BASIC_INFORMATION info; - u8 *chunk; - u8 *p = 0; - usize curAttempt = 1; - while (p < si.lpMaximumApplicationAddress) - { - if (VirtualQueryEx(process, p, &info, sizeof(info)) == sizeof(info)) - { - p = (u8 *) info.BaseAddress; - chunk = (u8 *) malloc(info.RegionSize); - usize bytesRead; - if (ReadProcessMemory( - process, p, (u8 *) chunk + 0, info.RegionSize, &bytesRead)) - { - for (usize i = 0; i < (bytesRead - len); ++i) - { - if (memcmp(data, (u8 *) chunk + i, len) == 0) - { - free(chunk); - if (curAttempt >= maxAttempts) - { - return (u8 *) p + i; - } - else - { - curAttempt += 1; - } +GetAddressOfData(DWORD pid, const u8 *data, usize len, u8 maxAttempts) { + HANDLE process = + OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, pid); + if (process) { + SYSTEM_INFO si; + GetSystemInfo(&si); + + MEMORY_BASIC_INFORMATION info; + u8 *chunk; + u8 *p = 0; + usize curAttempt = 1; + while (p < si.lpMaximumApplicationAddress) { + if (VirtualQueryEx(process, p, &info, sizeof(info)) == sizeof(info)) { + p = (u8 *) info.BaseAddress; + chunk = (u8 *) malloc(info.RegionSize); + usize bytesRead; + if (ReadProcessMemory( + process, p, (u8 *) chunk + 0, info.RegionSize, &bytesRead)) { + for (usize i = 0; i < (bytesRead - len); ++i) { + if (memcmp(data, (u8 *) chunk + i, len) == 0) { + free(chunk); + if (curAttempt >= maxAttempts) { + return (u8 *) p + i; + } else { + curAttempt += 1; + } + } + } + } + free(chunk); + p += info.RegionSize; } - } } - free(chunk); - p += info.RegionSize; - } } - } - return 0; + return 0; } usize -GetEmuBaseAddress(char *szExeName, u8 maxAttempts) -{ - GetProcessIdFromName(&processID, szExeName); - u8 *ret = GetAddressOfData(processID, EMU_BASE_MAGIC_STRING, - sizeof(EMU_BASE_MAGIC_STRING), maxAttempts); +GetEmuBaseAddress(wchar_t *szExeName, u8 maxAttempts) { + GetProcessIdFromName(&processID, szExeName); + u8 *ret = GetAddressOfData(processID, EMU_BASE_MAGIC_STRING, + sizeof(EMU_BASE_MAGIC_STRING), maxAttempts); - return (usize) ret; + return (usize) ret; } #endif + diff --git a/includes/vst_time.h b/includes/vst_time.h index d4a6423..b95157f 100644 --- a/includes/vst_time.h +++ b/includes/vst_time.h @@ -4,101 +4,95 @@ #define OFFSET_TIME_PLAYED 0x061074 // 4 bytes void -PrintGameTimeShort(game_time *GameTime) -{ - u32 BytesWritten; +PrintGameTimeShort(game_time *GameTime) { + u32 BytesWritten; - u8 Seconds = GameTime->Seconds; - u8 Minutes = GameTime->Minutes; - u8 Hours = GameTime->Hours; + u8 Seconds = GameTime->Seconds; + u8 Minutes = GameTime->Minutes; + u8 Hours = GameTime->Hours; - sprintf_s(szBuffer, _countof(szBuffer), "\nGAME TIME:\n"); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"\nGAME TIME:\n"); + WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "%02i:%02i:%02i\n", Hours, Minutes, - Seconds); - WriteToBackBuffer(); + swprintf_s(szBuffer, _countof(szBuffer), L"%02i:%02i:%02i\n", Hours, Minutes, + Seconds); + WriteToBackBuffer(); } void -PrintGameTimeRecord(game_time *RecordTime) -{ - u8 Seconds = RecordTime->Seconds; - u8 Minutes = RecordTime->Minutes; - u8 Hours = RecordTime->Hours; - - fprintf(stdout, "\nRECORD TIME:\n"); - fprintf(stdout, "%02i:%02i:%02i\n", Hours, Minutes, Seconds); +PrintGameTimeRecord(game_time *RecordTime) { + u8 Seconds = RecordTime->Seconds; + u8 Minutes = RecordTime->Minutes; + u8 Hours = RecordTime->Hours; + + fwprintf(stdout, L"\nRECORD TIME:\n"); + fwprintf(stdout, L"%02i:%02i:%02i\n", Hours, Minutes, Seconds); } void -ReadGameTime(game_time *GameTime) -{ +ReadGameTime(game_time *GameTime) { - usize BytesToRead = sizeof(game_time); - usize BytesRead; + usize BytesToRead = sizeof(game_time); + usize BytesRead; - ReadGameMemory(processID, OFFSET_TIME_PLAYED, BytesToRead, GameTime); + ReadGameMemory(processID, OFFSET_TIME_PLAYED, BytesToRead, GameTime); } void -WriteGameTimeToFile(game_time *GameTime) -{ - u8 Seconds = GameTime->Seconds; - u8 Minutes = GameTime->Minutes; - u8 Hours = GameTime->Hours; +WriteGameTimeToFile(game_time *GameTime) { + u8 Seconds = GameTime->Seconds; + u8 Minutes = GameTime->Minutes; + u8 Hours = GameTime->Hours; - FILE *fpGameTime = fopen("game_data/time/game_time.txt", "w"); + FILE *fpGameTime = _wfopen(L"game_data/time/game_time.txt", L"w"); - // Standard time (seconds accuracy) - fprintf(fpGameTime, "%02i:%02i:%02i", Hours, Minutes, Seconds); + // Standard time (seconds accuracy) + fwprintf(fpGameTime, L"%02i:%02i:%02i", Hours, Minutes, Seconds); - fclose(fpGameTime); + fclose(fpGameTime); } void -WriteGameTimeRecordToFile(game_time *RecordTime) -{ - TCHAR szFullPath[MAX_PATH]; +WriteGameTimeRecordToFile(game_time *RecordTime) { + TCHAR szFullPath[MAX_PATH]; - WriteTimeStampFileString(); + WriteTimeStampFileString(); - sprintf( - szFullPath, "game_data/time/records/%s-record-time.txt", szTimeStampFile); + swprintf_s( + szFullPath, _countof(szFullPath), L"game_data/time/records/%s-record-time.txt", szTimeStampFile); - u8 Seconds = RecordTime->Seconds; - u8 Minutes = RecordTime->Minutes; - u8 Hours = RecordTime->Hours; + u8 Seconds = RecordTime->Seconds; + u8 Minutes = RecordTime->Minutes; + u8 Hours = RecordTime->Hours; - FILE *fpRecordTime = fopen(szFullPath, "w"); + FILE *fpRecordTime = _wfopen(szFullPath, L"w"); - // Standard time (seconds accuracy) - fprintf(fpRecordTime, "Record Time\n%02i:%02i:%02i", Hours, Minutes, Seconds); + // Standard time (seconds accuracy) + fwprintf(fpRecordTime, L"Record Time\n%02i:%02i:%02i", Hours, Minutes, Seconds); - fclose(fpRecordTime); + fclose(fpRecordTime); } BOOL -GameTimeChanged(game_time *Time1, game_time *Time2) -{ - usize DataSize = sizeof(game_time); +GameTimeChanged(game_time *Time1, game_time *Time2) { + usize DataSize = sizeof(game_time); - BOOL Result = DataChanged((void *) Time1, (void *) Time2, DataSize); + BOOL Result = DataChanged((void *) Time1, (void *) Time2, DataSize); - return Result; + return Result; } BOOL -IsItLater(game_time *TimeOld, game_time *TimeNew) -{ - u32 Old = (u32)(((u32)(TimeOld->Seconds) << 16) | // - ((u32)(TimeOld->Minutes) << 8) | // - ((u32)(TimeOld->Hours))); - u32 New = (u32)(((u32)(TimeNew->Seconds) << 16) | // - ((u32)(TimeNew->Minutes) << 8) | // - ((u32)(TimeNew->Hours))); - - return New > Old; +IsItLater(game_time *TimeOld, game_time *TimeNew) { + u32 Old = (u32)(((u32)(TimeOld->Seconds) << 16) | // + ((u32)(TimeOld->Minutes) << 8) | // + ((u32)(TimeOld->Hours))); + u32 New = (u32)(((u32)(TimeNew->Seconds) << 16) | // + ((u32)(TimeNew->Minutes) << 8) | // + ((u32)(TimeNew->Hours))); + + return New > Old; } #endif + diff --git a/includes/vst_translate.h b/includes/vst_translate.h index 79de189..7568423 100644 --- a/includes/vst_translate.h +++ b/includes/vst_translate.h @@ -3,138 +3,375 @@ #define OFFSET_EQUIPPED_WEAPON_NAME_STRING 0x11fa7c -u8 TranslationTableHex[125] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, - 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, - 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x4a, 0x4c, 0x4d, - 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, - 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x8f, 0x90, 0x91, 0x94, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, - 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa7, 0xa8, - 0xe8 }; - -char TranslationTableChars[125] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', - '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', - 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', - 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'Â', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', - 'Ì', 'Î', 'Ò', 'Ó', 'Ô', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'ß', 'æ', 'à', 'á', 'â', - 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ò', 'ó', 'ô', 'ö', 'ù', - 'ú', 'û', 'u', ' ', '!', '"', '%', '\'', '(', ')', '{', '}', '[', ']', ';', - ':', ',', '.', '/', '\\', '<', '>', '?', '-', '+', '\n' }; +typedef struct text_char { + u8 HexCode; + char* Glyph; +} text_char; + +text_char TranslationTable[] = { + { 0x00, "0" }, + { 0x01, "1" }, + { 0x02, "2" }, + { 0x03, "3" }, + { 0x04, "4" }, + { 0x05, "5" }, + { 0x06, "6" }, + { 0x07, "7" }, + { 0x08, "8" }, + { 0x09, "9" }, + { 0x0A, "A" }, + { 0x0B, "B" }, + { 0x0C, "C" }, + { 0x0D, "D" }, + { 0x0E, "E" }, + { 0x0F, "F" }, + { 0x10, "G" }, + { 0x11, "H" }, + { 0x12, "I" }, + { 0x13, "J" }, + { 0x14, "K" }, + { 0x15, "L" }, + { 0x16, "M" }, + { 0x17, "N" }, + { 0x18, "O" }, + { 0x19, "P" }, + { 0x1A, "Q" }, + { 0x1B, "R" }, + { 0x1C, "S" }, + { 0x1D, "T" }, + { 0x1E, "U" }, + { 0x1F, "V" }, + { 0x20, "W" }, + { 0x21, "X" }, + { 0x22, "Y" }, + { 0x23, "Z" }, + { 0x24, "a" }, + { 0x25, "b" }, + { 0x26, "c" }, + { 0x27, "d" }, + { 0x28, "e" }, + { 0x29, "f" }, + { 0x2A, "g" }, + { 0x2B, "h" }, + { 0x2C, "i" }, + { 0x2D, "j" }, + { 0x2E, "k" }, + { 0x2F, "l" }, + { 0x30, "m" }, + { 0x31, "n" }, + { 0x32, "o" }, + { 0x33, "p" }, + { 0x34, "q" }, + { 0x35, "r" }, + { 0x36, "s" }, + { 0x37, "t" }, + { 0x38, "u" }, + { 0x39, "v" }, + { 0x3A, "w" }, + { 0x3B, "x" }, + { 0x3C, "y" }, + { 0x3D, "z" }, + { 0x40, "Ć" }, + { 0x41, "Â" }, + { 0x42, "Ä" }, + { 0x43, "Ç" }, + { 0x44, "È" }, + { 0x45, "É" }, + { 0x46, "Ê" }, + { 0x47, "Ë" }, + { 0x48, "Ì" }, + { 0x49, "ő" }, + { 0x4A, "Î" }, + { 0x4B, "í" }, + { 0x4C, "Ò" }, + { 0x4D, "Ó" }, + { 0x4E, "Ô" }, + { 0x4F, "Ö" }, + { 0x50, "Ù" }, + { 0x51, "Ú" }, + { 0x52, "Û" }, + { 0x53, "Ü" }, + { 0x54, "ß" }, + { 0x55, "æ" }, + { 0x56, "à" }, + { 0x57, "á" }, + { 0x58, "â" }, + { 0x59, "ä" }, + { 0x5A, "ç" }, + { 0x5B, "è" }, + { 0x5C, "é" }, + { 0x5D, "ê" }, + { 0x5E, "ë" }, + { 0x5F, "ì" }, + { 0x60, "í" }, + { 0x61, "î" }, + { 0x62, "ï" }, + { 0x63, "ò" }, + { 0x64, "ó" }, + { 0x65, "ô" }, + { 0x66, "ö" }, + { 0x67, "ù" }, + { 0x68, "ú" }, + { 0x69, "û" }, + { 0x6A, "ü" }, + { 0x87, "‼" }, + { 0x88, "≠" }, + { 0x89, "≦" }, + { 0x8A, "≧" }, + { 0x8B, "÷" }, + { 0x8C, "-" }, + { 0x8D, "—" }, + { 0x8E, "⋯" }, + { 0x8F, " " }, + { 0x90, "!" }, + { 0x91, "\"" }, + { 0x92, "#" }, + { 0x93, "$" }, + { 0x94, "%" }, + { 0x95, "&" }, + { 0x96, "\'" }, + { 0x97, "(" }, + { 0x98, ")" }, + { 0x99, "{" }, + { 0x9A, "}" }, + { 0x9B, "[" }, + { 0x9C, "]" }, + { 0x9D, ";" }, + { 0x9E, ":" }, + { 0x9F, "," }, + { 0xA0, "." }, + { 0xA1, "/" }, + { 0xA2, "\\" }, + { 0xA3, "<" }, + { 0xA4, ">" }, + { 0xA5, "?" }, + { 0xA6, "_" }, + { 0xA7, "-" }, + { 0xA8, "+" }, + { 0xA9, "*" }, + { 0xAB, "{" }, + { 0xAC, "}" }, + { 0xAD, "♪" }, + { 0xE8, "\n" }, + { 0xEB, "_" }, + { 0xB6, "Lv." }, + /* + { 0xF801, "«p1»" }, + { 0xF802, "«p2»" }, + { 0xF808, "«p8»" }, + { 0xF80A, "«p10»" }, + { 0xFA06, " " } + */ +}; void -ReadWeaponName() -{ - nameWeaponCur[0] = '\0'; - - // Check if weapon is eqipped - if (itemBladeCur.ListPosition == 0 || itemBladeCur.ListPosition > 511) - { - return; - } - - char WeaponNameHex[WEAPON_NAME_LENGTH]; - usize BytesToRead = (usize) WEAPON_NAME_LENGTH; - - usize BytesRead = ReadGameMemory(processID, - OFFSET_EQUIPPED_WEAPON_NAME_STRING, BytesToRead, WeaponNameHex); - - for (int i = 0, k = 0; i < WEAPON_NAME_LENGTH; ++i) - { - u8 *HexCode = (u8 *) &WeaponNameHex[i]; - if (*HexCode == 0xe7) - { - nameWeaponCur[k] = '\0'; - break; - } +ReadWeaponName() { + nameWeaponCur[0] = L'\0'; + // Check if any weapon is eqipped + if (itemBladeCur.ListPosition == 0 || itemBladeCur.ListPosition > 511) return; - if (*HexCode == 0xfa && *(HexCode + 1) == 0x06) - { - nameWeaponCur[k++] = ' '; - i++; - continue; - } + wchar_t *temp = malloc(WEAPON_NAME_UNICODE_LENGTH * sizeof(wchar_t)); + int temp_size = 0; + u8 WeaponNameHex[WEAPON_NAME_HEX_LENGTH]; + usize BytesToRead = (usize) WEAPON_NAME_HEX_LENGTH; + + usize BytesRead = ReadGameMemory(processID, + OFFSET_EQUIPPED_WEAPON_NAME_STRING, BytesToRead, WeaponNameHex); - for (int j = 0, size = _countof(TranslationTableHex); j < size; ++j) - { - if (TranslationTableHex[j] == (char) *HexCode) - { - nameWeaponCur[k++] = TranslationTableChars[j]; - break; - } + for (int i = 0; i < WEAPON_NAME_HEX_LENGTH; ++i) { + u8 *HexCode = &WeaponNameHex[i]; + switch (*HexCode) { + case 0xe7: // end of string + { + swprintf_s(nameWeaponCur, WEAPON_NAME_UNICODE_LENGTH, L"%s\00", nameWeaponCur); + free(temp); + return; + break; + } + case 0xf8: // special strings + { + switch (*(HexCode+1)) { + case 0x01: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p1»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x02: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p2»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x08: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p8»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x0a: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p10»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + } + } + case 0xfa: + switch (*(HexCode + 1)) { + case 0x06: + swprintf_s(nameWeaponCur, WEAPON_NAME_UNICODE_LENGTH, L"%s ", nameWeaponCur); + i++; + continue; + break; + } + default: // standard characters + for (int j = 0, count = _countof(TranslationTable); j < count; j++) { + if (TranslationTable[j].HexCode == *HexCode) { + char *mbyte = TranslationTable[j].Glyph; + temp_size = MultiByteToWideChar(CP_UTF8, 0, mbyte, -1, temp, WEAPON_NAME_UNICODE_LENGTH); + swprintf_s(nameWeaponCur, WEAPON_NAME_UNICODE_LENGTH, L"%s%s", nameWeaponCur, temp); + break; + } + } + } } - } + free(temp); } void -ReadActorName(u32 NameOffset) -{ - ActorName[0] = '\0'; - - char ActorNameHex[ACTOR_NAME_LENGTH]; - usize BytesToRead = (usize) ACTOR_NAME_LENGTH; - - usize BytesRead = - ReadGameMemory(processID, NameOffset, BytesToRead, ActorNameHex); - - for (int i = 0, k = 0; i < ACTOR_NAME_LENGTH; ++i) - { - u8 *HexCode = (u8 *) &ActorNameHex[i]; - if (*HexCode == 0xe7 || *HexCode == 0x00) - { - ActorName[k] = '\0'; - break; - } +ReadActorName(u32 NameOffset) { + ActorName[0] = L'\00'; + + wchar_t *temp = malloc(ACTOR_NAME_UNICODE_LENGTH * sizeof(wchar_t)); + int temp_size = 0; + u8 ActorNameHex[ACTOR_NAME_HEX_LENGTH]; + usize BytesToRead = (usize) ACTOR_NAME_HEX_LENGTH; - if (*HexCode == 0xfa && *(HexCode + 1) == 0x06) - { - ActorName[k++] = ' '; - i++; - continue; + usize BytesRead = + ReadGameMemory(processID, NameOffset, BytesToRead, ActorNameHex); + + for (int i = 0; i < ACTOR_NAME_HEX_LENGTH; ++i) { + u8 *HexCode = &ActorNameHex[i]; + switch (*HexCode) { + case 0xe7: // end of string + { + swprintf_s(nameWeaponCur, ACTOR_NAME_UNICODE_LENGTH, L"%s\00", nameWeaponCur); + free(temp); + return; + break; + } + case 0xf8: // special strings + { + switch (*(HexCode + 1)) { + case 0x01: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p1»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x02: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p2»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x08: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p8»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + case 0x0a: + temp_size = MultiByteToWideChar(CP_UTF8, 0, "«p10»", -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + i++; + continue; + break; + } + } + case 0xfa: + switch (*(HexCode + 1)) { + case 0x06: + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s ", ActorName); + i++; + continue; + break; + } + default: // standard characters + for (int j = 0, count = _countof(TranslationTable); j < count; j++) { + if (TranslationTable[j].HexCode == *HexCode) { + char *mbyte = TranslationTable[j].Glyph; + temp_size = MultiByteToWideChar(CP_UTF8, 0, mbyte, -1, temp, ACTOR_NAME_UNICODE_LENGTH); + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%s%s", ActorName, temp); + break; + } + } + } } + free(temp); +} - for (int j = 0, size = _countof(TranslationTableHex); j < size; ++j) - { - if (TranslationTableHex[j] == (char) *HexCode) - { - ActorName[k++] = TranslationTableChars[j]; - break; - } +void +_ReadActorName(u32 NameOffset) { + ActorName[0] = L'\00'; + + char ActorNameHex[ACTOR_NAME_HEX_LENGTH]; + usize BytesToRead = (usize) ACTOR_NAME_HEX_LENGTH; + + usize BytesRead = + ReadGameMemory(processID, NameOffset, BytesToRead, ActorNameHex); + + for (int i = 0, k = 0; i < ACTOR_NAME_HEX_LENGTH; ++i) { + u8 *HexCode = (u8 *) &ActorNameHex[i]; + if (*HexCode == 0xe7 || *HexCode == 0x00) + { + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%ls\00", ActorName); + break; + } + + if (*HexCode == 0xfa && *(HexCode + 1) == 0x06) + { + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%ls ", ActorName); + i++; + continue; + } + + for (int j = 0, size = _countof(TranslationTable); j < size; ++j) + { + if (TranslationTable[j].HexCode == (char) *HexCode) + { + + swprintf_s(ActorName, ACTOR_NAME_UNICODE_LENGTH, L"%ls%hs", ActorName, TranslationTable[j].Glyph); + break; + } + } } - } } void -ReadWeaponNumber() -{ - u8 *tempBuffer; +ReadWeaponNumber() { + u8 *tempBuffer; - char number_s[1]; - number_s[0] = nameWeaponCur[strlen(nameWeaponCur) - 1]; + char number_s[1]; + number_s[0] = nameWeaponCur[wcslen(nameWeaponCur) - 1]; - WeaponNumber = strtoul(number_s, &tempBuffer, 10); + WeaponNumber = strtoul(number_s, &tempBuffer, 10); } BOOL -WeaponNameChanged() -{ - if (strcmp(nameWeaponPrev, nameWeaponCur) == 0) - { - return FALSE; - } - - return TRUE; +WeaponNameChanged() { + if (wcscmp(nameWeaponPrev, nameWeaponCur) == 0) { + return FALSE; + } + return TRUE; } void -PrintWeaponName() -{ - sprintf_s( - szBuffer, _countof(szBuffer), "\nWEAPON NAME:\n%s\n", nameWeaponCur); - WriteToBackBuffer(); +PrintWeaponName() { + swprintf_s( + szBuffer, _countof(szBuffer), L"\nWEAPON NAME:\n%s\n", nameWeaponCur); + WriteToBackBuffer(); } #endif diff --git a/includes/vst_types.h b/includes/vst_types.h index 34c2859..dc5b979 100644 --- a/includes/vst_types.h +++ b/includes/vst_types.h @@ -26,188 +26,175 @@ typedef double f64; // Play Time #pragma pack(push, 1) -typedef struct -{ - u8 Centiseconds; // 1/100th of a second - u8 Seconds; - u8 Minutes; - u8 Hours; +typedef struct { + u8 Centiseconds; // 1/100th of a second + u8 Seconds; + u8 Minutes; + u8 Hours; } game_time; #pragma pack(pop) // Player/Weapon Range -typedef struct -{ - // Area shape (bits 0-2): - // 1 spheroid - // 2 upward cylinder - // 3 up-downward cylinder - // 4 downward cone (base is at casting position) - // 5 upward cone (point is at casting position) - // 6 cuboid - // 7 rhombohedron - - // Shape angle (bits 3-7): - // increment by 360°/32, - // center is casting position, - // direction is upward, incrementing backward - u8 x; - u8 y; - u8 z; - - union - { - u8 ShapeAngleCompound; - struct - { - u8 Shape : 3; - u8 Angle : 5; - }; - } ShapeAngle; +typedef struct { + // Area shape (bits 0-2): + // 1 spheroid + // 2 upward cylinder + // 3 up-downward cylinder + // 4 downward cone (base is at casting position) + // 5 upward cone (point is at casting position) + // 6 cuboid + // 7 rhombohedron + + // Shape angle (bits 3-7): + // increment by 360°/32, + // center is casting position, + // direction is upward, incrementing backward + u8 x, y, z; + + union { + u8 ShapeAngleCompound; + struct { + u8 Shape : 3; + u8 Angle : 5; + }; + } ShapeAngle; } range; -typedef struct -{ - union - { - u16 FlagsCompound; - struct - { - u16 Human : 1; - u16 Beast : 1; - u16 Undead : 1; - u16 Phantom : 1; - u16 Dragon : 1; - u16 Evil : 1; - u16 Physical : 1; - u16 Air : 1; - u16 Fire : 1; - u16 Earth : 1; - u16 Water : 1; - u16 Light : 1; - u16 Dark : 1; - }; - } Flags; +typedef struct { + union { + u16 FlagsCompound; + struct { + u16 Human : 1; + u16 Beast : 1; + u16 Undead : 1; + u16 Phantom : 1; + u16 Dragon : 1; + u16 Evil : 1; + u16 Physical : 1; + u16 Air : 1; + u16 Fire : 1; + u16 Earth : 1; + u16 Water : 1; + u16 Light : 1; + u16 Dark : 1; + }; + } Flags; } leveling_flags; // Item Extended Info #pragma pack(push, 1) -typedef struct -{ - u16 NamesListPosition; - u8 ListPosition; - u8 WepFileNumber; - u8 Category; +typedef struct { + u16 NamesListPosition; + u8 ListPosition; + u8 WepFileNumber; + u8 Category; - i8 STR; - i8 INT; - i8 AGL; + i8 STR; + i8 INT; + i8 AGL; - u16 DPCur; - u16 DPMax; - u16 PPCur; - u16 PPMax; + u16 DPCur; + u16 DPMax; + u16 PPCur; + u16 PPMax; - // Blades only - // (1=MP 2=RISK 3=HP 4=PP 5=nothing) - u8 DamageType; - u8 StatsCostType; - u8 StatsCostValue; + // Blades only + // (1=MP 2=RISK 3=HP 4=PP 5=nothing) + u8 DamageType; + u8 StatsCostType; + u8 StatsCostValue; - u8 Material; + u8 Material; - i8 _padding0; + i8 _padding0; - u8 GemSlots; // grips and shields only - u8 GemsSpecialEffects; // gems only + u8 GemSlots; // grips and shields only + u8 GemsSpecialEffects; // gems only - u8 EqiupmentListIndex; // RAM only + u8 EqiupmentListIndex; // RAM only - range Range; // blades only + range Range; // blades only - i8 _padding1; + i8 _padding1; - // Type (grips only) - u8 TypeBlunt; - u8 TypeEdged; - u8 TypePiercing; + // Type (grips only) + u8 TypeBlunt; + u8 TypeEdged; + u8 TypePiercing; - // Class - i8 ClassHuman; - i8 ClassBeast; - i8 ClassUndead; - i8 ClassPhantom; - i8 ClassDragon; - i8 ClassEvil; + // Class + i8 ClassHuman; + i8 ClassBeast; + i8 ClassUndead; + i8 ClassPhantom; + i8 ClassDragon; + i8 ClassEvil; - i16 _padding2; + i16 _padding2; - // Affinity - i8 AffinityPhysical; - i8 AffinityAir; - i8 AffinityFire; - i8 AffinityEarth; - i8 AffinityWater; - i8 AffinityLight; - i8 AffinityDark; + // Affinity + i8 AffinityPhysical; + i8 AffinityAir; + i8 AffinityFire; + i8 AffinityEarth; + i8 AffinityWater; + i8 AffinityLight; + i8 AffinityDark; - i8 _padding3; + i8 _padding3; } item_data; #pragma pack(pop) // Player Stats #pragma pack(push, 1) -typedef struct -{ - u16 HPCur; - u16 HPMax; - u16 MPCur; - u16 MPMax; - u16 Risk; - u16 STRCur; - u16 STRBase; - u16 INTCur; - u16 INTBase; - u16 AGLCur; - u16 AGLBase; +typedef struct { + u16 HPCur; + u16 HPMax; + u16 MPCur; + u16 MPMax; + u16 Risk; + u16 STRCur; + u16 STRBase; + u16 INTCur; + u16 INTBase; + u16 AGLCur; + u16 AGLBase; - u8 _padding0[3]; + u8 _padding0[3]; - u8 WalkingSpeedWithBox; + u8 WalkingSpeedWithBox; - u8 _padding1; + u8 _padding1; - u8 RunningSpeed; + u8 RunningSpeed; - u32 _padding2; + u32 _padding2; - range Range; + range Range; } player_stats; #pragma pack(pop) // Player status effects (buffs / debuffs) #pragma pack(push, 1) -typedef struct -{ - u32 EffectID; // bit mask +typedef struct { + u32 EffectID; // bit mask - u8 _padding0; + u8 _padding0[2]; - u8 DurationOrFrequency; + u8 DurationOrFrequency; - u8 _padding1; + u8 _padding1; - u32 CanceledBy; // bit mask - u32 ImmunizedBy; // bit mask + u32 CanceledBy; // bit mask + u32 ImmunizedBy; // bit mask } status_effects; #pragma pack(pop) // Player Location #pragma pack(push, 1) -typedef struct -{ - u8 ZoneNumber; - u8 MapNumber; +typedef struct { + u8 ZoneNumber; + u8 MapNumber; } location; #pragma pack(pop) @@ -219,125 +206,117 @@ typedef struct #define CHEST_COUNT_FLAGS 64 #pragma pack(push, 1) -typedef struct -{ - u16 Human; - u16 Beast; - u16 Undead; - u16 Phantom; - u16 Dragon; - u16 Evil; +typedef struct { + u16 Human; + u16 Beast; + u16 Undead; + u16 Phantom; + u16 Dragon; + u16 Evil; } kill_list; #pragma pack(pop) #pragma pack(push, 1) -typedef struct -{ - u16 Unarmed; - u16 Dagger; - u16 Sword; - u16 GreatSword; - u16 AxeMace; - u16 GreatAxe; - u16 Staff; - u16 HeavyMace; - u16 Polearm; - u16 Crossbow; +typedef struct { + u16 Unarmed; + u16 Dagger; + u16 Sword; + u16 GreatSword; + u16 AxeMace; + u16 GreatAxe; + u16 Staff; + u16 HeavyMace; + u16 Polearm; + u16 Crossbow; } weapon_usage; #pragma pack(pop) #pragma pack(push, 1) -typedef struct -{ - u8 Flags[MAP_COUNT_FLAGS]; +typedef struct { + u8 Flags[MAP_COUNT_FLAGS]; } map_flag_mem; #pragma pack(pop) #pragma pack(push, 1) -typedef struct -{ - u8 Flags[CHEST_COUNT_FLAGS]; +typedef struct { + u8 Flags[CHEST_COUNT_FLAGS]; } chest_flag_mem; #pragma pack(pop) -typedef struct -{ - u8 FlagByte; - u8 Zone; - u8 Map; +typedef struct { + u8 FlagByte; + u8 Zone; + u8 Map; } chest_flag_check; -typedef struct -{ - u8 MaskByte; - u8 MaskBit; - u8 Zone; - u8 Map; +typedef struct { + u8 MaskByte; + u8 MaskBit; + u8 Zone; + u8 Map; } map_flag_check; /* #pragma pack(push, 1) typedef struct { - u32 L2; - u32 R2; - u32 L1; - u32 R1; - u32 Triangle; - u32 Circle; - u32 Cross; - u32 Square; - u32 Select; - u32 L3; - u32 R3; - u32 Start; - u32 Up; - u32 Right; - u32 Down; - u32 Left; +u32 L2; +u32 R2; +u32 L1; +u32 R1; +u32 Triangle; +u32 Circle; +u32 Cross; +u32 Square; +u32 Select; +u32 L3; +u32 R3; +u32 Start; +u32 Up; +u32 Right; +u32 Down; +u32 Left; } buttons_timers; #pragma pack(pop) */ #pragma pack(push, 1) -typedef struct -{ - u32 Timers[16]; +typedef struct { + u32 Timers[16]; } buttons_timers; #pragma pack(pop) #pragma pack(push, 1) -typedef struct -{ - u32 NextActorPtr; // 0 - u8 _padding1[40]; // 4 - u16 PosX; // 44 (0x2c) - u16 PosY; // 46 (0x2e) - u8 _padding2[12]; // 48 (0x30) - u32 NamePointer; // 60 (0x3c) - u8 _padding3[16]; // 64 (0x40) - char Name[20]; // 80 (0x50) - u8 _padding4[4]; // 100 (0x64) - u16 HPCur; // 104 (0x68) - u16 HPMax; // 106 (0x6a) - u16 MPCur; // 108 (0x6c) - u16 MPMax; // 110 (0x6e) - u16 Risk; // 112 (0x70) - u16 STRCur; // 114 (0x72) - u16 STRMax; // 116 (0x74) - u16 INTCur; // 118 (0x76) - u16 INTMax; // 120 (0x78) - u16 AGLCur; // 122 (0x7a) - u16 AGLMax; // 124 (0x7c) - u8 _padding5[14]; // 126 (0x7e) - char WeaponName[18]; // 140 (0x8c) +typedef struct { + u32 NextActorPtr; // 0 + u8 _padding1[40]; // 4 + u16 PosX; // 44 (0x2c) + u16 PosY; // 46 (0x2e) + u8 _padding2[12]; // 48 (0x30) + u32 NamePointer; // 60 (0x3c) + u8 _padding3[16]; // 64 (0x40) + char Name[20]; // 80 (0x50) + u8 _padding4[4]; // 100 (0x64) + u16 HPCur; // 104 (0x68) + u16 HPMax; // 106 (0x6a) + u16 MPCur; // 108 (0x6c) + u16 MPMax; // 110 (0x6e) + u16 Risk; // 112 (0x70) + u16 STRCur; // 114 (0x72) + u16 STRMax; // 116 (0x74) + u16 INTCur; // 118 (0x76) + u16 INTMax; // 120 (0x78) + u16 AGLCur; // 122 (0x7a) + u16 AGLMax; // 124 (0x7c) + u8 _padding5[14]; // 126 (0x7e) + char WeaponName[18]; // 140 (0x8c) } actor_data; #pragma pack(pop) -typedef struct -{ - u32 ActorPointer; - BOOL IsDead; +typedef struct { + u32 ActorPointer; + BOOL IsDead; } actor_status; #endif + diff --git a/includes/vst_utils.h b/includes/vst_utils.h index b42b255..66316b8 100644 --- a/includes/vst_utils.h +++ b/includes/vst_utils.h @@ -2,63 +2,58 @@ #define _VST_UTILS_H SYSTEMTIME stLocalTime; -char szTimeStampDebug[64]; -char szTimeStampFile[64]; +wchar_t szTimeStampDebug[64]; +wchar_t szTimeStampFile[64]; BOOL -DataChanged(void *Struct1, void *Struct2, usize StructSize) -{ - u8 *pStruct1 = Struct1; - u8 *pStruct2 = Struct2; - - for (int i = 0; i < StructSize; ++i) - { - if (*pStruct1++ != *pStruct2++) - { - return TRUE; +DataChanged(void *Struct1, void *Struct2, usize StructSize) { + u8 *pStruct1 = Struct1; + u8 *pStruct2 = Struct2; + + for (int i = 0; i < StructSize; ++i) { + if (*pStruct1++ != *pStruct2++) { + return TRUE; + } } - } - return FALSE; + return FALSE; } void -WriteTimeStampDebugString() -{ - GetLocalTime(&stLocalTime); - - sprintf_s(szTimeStampDebug, _countof(szTimeStampDebug), // - "%04d-%02d-%02d %02d:%02d:%02d: ", // - stLocalTime.wYear, // - stLocalTime.wMonth, // - stLocalTime.wDay, // - stLocalTime.wHour, // - stLocalTime.wMinute, // - stLocalTime.wSecond); +WriteTimeStampDebugString() { + GetLocalTime(&stLocalTime); + + swprintf_s(szTimeStampDebug, _countof(szTimeStampDebug), // + L"%04d-%02d-%02d %02d:%02d:%02d: ", // + stLocalTime.wYear, // + stLocalTime.wMonth, // + stLocalTime.wDay, // + stLocalTime.wHour, // + stLocalTime.wMinute, // + stLocalTime.wSecond); } void -WriteTimeStampFileString() -{ - GetLocalTime(&stLocalTime); - - sprintf_s(szTimeStampFile, _countof(szTimeStampFile), // - "%04d%02d%02dT%02d%02d%02d", // - stLocalTime.wYear, // - stLocalTime.wMonth, // - stLocalTime.wDay, // - stLocalTime.wHour, // - stLocalTime.wMinute, // - stLocalTime.wSecond); +WriteTimeStampFileString() { + GetLocalTime(&stLocalTime); + + swprintf_s(szTimeStampFile, _countof(szTimeStampFile), // + L"%04d%02d%02dT%02d%02d%02d", // + stLocalTime.wYear, // + stLocalTime.wMonth, // + stLocalTime.wDay, // + stLocalTime.wHour, // + stLocalTime.wMinute, // + stLocalTime.wSecond); } u16 -ErrorExit(char *Message) -{ - u32 ErrorCode = GetLastError(); +ErrorExit(wchar_t *Message) { + u32 ErrorCode = GetLastError(); - fprintf(stderr, "\n\n%s failed with the error code %d", Message, ErrorCode); + fwprintf(stderr, L"\n\n%ls failed with the error code %d", Message, ErrorCode); - exit(ErrorCode); + exit(ErrorCode); } -#endif \ No newline at end of file +#endif + diff --git a/main.c b/main.c index cd69904..cb7be2b 100644 --- a/main.c +++ b/main.c @@ -1,3 +1,11 @@ +#ifndef UNICODE +#define UNICODE +#endif + +#ifndef _UNICODE +#define _UNICODE +#endif + #include #include #include @@ -5,6 +13,7 @@ #include #include #include +#include #include "includes/vst_types.h" #include "includes/vst_init.h" @@ -22,88 +31,77 @@ #include "includes/vst_gazette.h" #include "includes/vst_debug.h" -// Main -int main(int argc, char *argv[]) { - char ver_s[3]; +int wmain(int argc, wchar_t *argv[]) { + _wsetlocale(LC_ALL, L".UTF8"); + + wchar_t ver_s[3]; u8 ver_d = 0; - do // repeat until the user enters a valid option - { + do { // repeat until the user enters a valid option switch (argc) { case 1: { - system("cls"); + system("cls"); - fprintf(stdout, "1. ePSXe\n"); - fprintf(stdout, "2. BizHawk\n"); - fprintf(stdout, "3. DuckStation (SDL)\n"); - fprintf(stdout, "4. DuckStation (QT)\n"); - fprintf(stdout, "5. pSX\n"); - fprintf(stdout, "6. no$psx\n\n"); + fwprintf(stdout, L"1. ePSXe\n"); + fwprintf(stdout, L"2. BizHawk\n"); + fwprintf(stdout, L"3. DuckStation\n"); + fwprintf(stdout, L"4. pSX\n"); + fwprintf(stdout, L"5. no$psx\n\n"); - fprintf(stdout, "0. Exit\n\n"); + fwprintf(stdout, L"0. Exit\n\n"); - fprintf(stdout, ">>> "); + fwprintf(stdout, L">>> "); - scanf_s("%2s", ver_s, (unsigned) _countof(ver_s)); + wscanf_s(L"%2s", ver_s, (unsigned) _countof(ver_s)); - break; - } + break; + } case 2: { - sprintf_s(ver_s, _countof(ver_s), argv[1]); - break; - } + swprintf_s(ver_s, _countof(ver_s), argv[1]); + break; + } } - ver_d = atoi(ver_s); + ver_d = _wtoi(ver_s); switch (ver_d) { case 0: { - exit(1); - break; - } + exit(1); + break; + } case 1: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "ePSXe.exe"); - sprintf_s(szModuleName, MAX_PATH, ""); - break; - } + emuBaseMaxAttempts = 1; + swprintf_s(szExeName, MAX_PATH, L"ePSXe.exe"); + swprintf_s(szModuleName, MAX_PATH, L""); + break; + } case 2: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "EmuHawk.exe"); - sprintf_s(szModuleName, MAX_PATH, "octoshock.dll"); - break; - } + emuBaseMaxAttempts = 1; + swprintf_s(szExeName, MAX_PATH, L"EmuHawk.exe"); + swprintf_s(szModuleName, MAX_PATH, L"octoshock.dll"); + break; + } case 3: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "duckstation-sdl-x64-ReleaseLTCG.exe"); - sprintf_s(szModuleName, MAX_PATH, ""); - - break; - } + emuBaseMaxAttempts = 1; + swprintf_s(szExeName, MAX_PATH, L"duckstation-qt-x64-ReleaseLTCG.exe"); + swprintf_s(szModuleName, MAX_PATH, L""); + break; + } case 4: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "duckstation-qt-x64-ReleaseLTCG.exe"); - sprintf_s(szModuleName, MAX_PATH, ""); - - break; - } + emuBaseMaxAttempts = 1; + swprintf_s(szExeName, MAX_PATH, L"psxfin.exe"); + swprintf_s(szModuleName, MAX_PATH, L""); + break; + } case 5: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "psxfin.exe"); - sprintf_s(szModuleName, MAX_PATH, ""); - - break; - } - case 6: { - emuBaseMaxAttempts = 1; - sprintf_s(szExeName, MAX_PATH, "NO$PSX.EXE"); - sprintf_s(szModuleName, MAX_PATH, ""); - - break; - } + emuBaseMaxAttempts = 1; + swprintf_s(szExeName, MAX_PATH, L"NO$PSX.EXE"); + swprintf_s(szModuleName, MAX_PATH, L""); + break; + } default: { - fprintf(stderr, "Wrong argument\n"); - Sleep(1000); - } + fwprintf(stderr, L"Wrong argument\n"); + Sleep(1000); + } } emuBaseAddress = GetEmuBaseAddress(szExeName, emuBaseMaxAttempts); @@ -111,25 +109,25 @@ int main(int argc, char *argv[]) { } while (!emuBaseAddress); /* - while (!(GetProcessIdFromName(&processID, szExeName))) - { - - system("cls"); - fprintf(stderr, "Error: Couldn't obtain process ID number.\n"); - fprintf(stderr, "Check if the emulator is running.\n"); - Sleep(1000); - }; - system("cls"); - - if (!strlen(szModuleName)) - { - processBaseAddress = GetModuleDllBase(processID, szExeName); - } - else - { - processBaseAddress = FindDllAddress(processID, szModuleName); - } - */ + while (!(GetProcessIdFromName(&processID, szExeName))) + { + + system("cls"); + fwprintf(stderr, L"Error: Couldn't obtain process ID number.\n"); + fwprintf(stderr, L"Check if the emulator is running.\n"); + Sleep(1000); + }; + system("cls"); + + if (!strlen(szModuleName)) + { + processBaseAddress = GetModuleDllBase(processID, szExeName); + } + else + { + processBaseAddress = FindDllAddress(processID, szModuleName); + } + */ // Setup the folders mkdir("debug"); @@ -148,10 +146,10 @@ int main(int argc, char *argv[]) { // PrintProcessVersion(processID); // PrintModuleFileName(processID); // EnumProcessModules2(processID); - // fprintf(stdout, "processID: %i\n", processID); - // fprintf(stdout, "processBaseAddress: 0x%llx\n", processBaseAddress); + // fwprintf(stdout, L"processID: %i\n", processID); + // fwprintf(stdout, L"processBaseAddress: 0x%llx\n", processBaseAddress); - // processBaseAddress = GetModuleDllBase(processID, "octoshock.dll"); + // processBaseAddress = GetModuleDllBase(processID, L"octoshock.dll"); // ListProcessThreads(processID); // ListProcessModules(processID); @@ -177,11 +175,10 @@ int main(int argc, char *argv[]) { SetCursorPosition(hStdout, 0, 0); SetCursorPosition(hBackBuffer, 0, 0); - // WriteBladeInfo(processID); - // ReadPlayerStats(&statsPlayerCur); - if (1) - // if (CheckPlayerStats(&statsPlayerCur)) + ReadPlayerStats(&statsPlayerCur); + + if (CheckPlayerStats(&statsPlayerCur)) { // TIME GameTimePrev = GameTimeCur; @@ -210,7 +207,6 @@ int main(int argc, char *argv[]) { #ifdef DEBUG GenerateMapCheckFlagList(); #endif - ReadBladeData(); ReadWeaponData(); ReadShieldData(); @@ -336,10 +332,10 @@ int main(int argc, char *argv[]) { PrintBladeLeveling(WeaponNumber); #endif // Check if weapon leveling name changed - strncpy(nameWeaponPrev, nameWeaponCur, WEAPON_NAME_LENGTH); + wcsncpy(nameWeaponPrev, nameWeaponCur, WEAPON_NAME_UNICODE_LENGTH); #ifdef DEBUG - sprintf_s(szBuffer, _countof(szBuffer), "WEAPON NUMBER: %zi\n", WeaponNumber); + swprintf_s(szBuffer, _countof(szBuffer), L"WEAPON NUMBER: %zi\n", WeaponNumber); WriteToBackBuffer(); #endif @@ -402,13 +398,13 @@ int main(int argc, char *argv[]) { PrintWeaponName(); #endif } else { - sprintf_s(szBuffer, _countof(szBuffer), - "============================\n" - "== VSTracker v0.5.0-alpha ==\n" - "============================\n"); + swprintf_s(szBuffer, _countof(szBuffer), + L"============================\n" + L"== VSTracker v0.6.0-alpha ==\n" + L"============================\n"); WriteToBackBuffer(); - sprintf_s(szBuffer, _countof(szBuffer), "\nWaiting for the game to load ...\n"); + swprintf_s(szBuffer, _countof(szBuffer), L"\nWaiting for the game to load ...\n"); WriteToBackBuffer(); } @@ -430,8 +426,9 @@ int main(int argc, char *argv[]) { PrintGameTimeRecord(&GameTimeRecord); - fprintf(stdout, "\nPress any key to exit the program...\n"); + fwprintf(stdout, L"\nPress any key to exit the program...\n"); getchar(); return 0; } + diff --git a/vstrack.rdbg b/vstrack.rdbg new file mode 100644 index 0000000..8c133b0 Binary files /dev/null and b/vstrack.rdbg differ