Skip to content

Commit

Permalink
feat: ✨ add support for version 4.0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Vieira <[email protected]>
  • Loading branch information
lucasvmx committed Jun 27, 2021
1 parent cc58cbc commit 598b932
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
11 changes: 8 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,14 @@ int main(int argc, char *argv[])

// Carrega a tradução selecionada
if(f->GetSelectedLanguage() == Ui::languages::ENGLISH) {
translator.load("spark_en_us");
app.installTranslator(&translator);
fprintf(stderr, "Loaded english translation\n");
auto result = translator.load("spark_en_us");
if(result) {
app.installTranslator(&translator);
fprintf(stderr, "Loaded english translation\n");
} else {
QMessageBox::critical(0, TR("Erro"), TR("Falha ao carregar a tradução"));
exit(1)
; }
} else {
fprintf(stderr, "Loaded portuguese translation\n");
}
Expand Down
2 changes: 1 addition & 1 deletion src/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ bool MainHackingThread::isGamePlayStarted() const
} else {
throw new Exception(tr("Essa versão do warzone ainda não suporta a detecção de status "
"(verificar se a partida foi iniciada). Envie um e-mail para "
"[email protected] e reporte o ocorrido :)").toStdString().c_str());
"[email protected] contendo a versão do jogo e reporte o ocorrido :)").toStdString().c_str());
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Versão do programa
#define SPARK_MAJOR 2
#define SPARK_MINOR 2
#define SPARK_PATCH 0
#define SPARK_PATCH 1

/**
* @brief nome do programa
Expand Down
5 changes: 3 additions & 2 deletions src/wzhack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ unsigned short WzHack_GetWarzoneVersion(const char *wz_filename)
// Compila o número de versão para um único número
iversion = (major * 100) + (minor * 10) + patch;

if((iversion > WZ_400) || (iversion < WZ_239))
if((iversion > WZ_401) || (iversion < WZ_239))
iversion = WZ_UNKNOWN;

if (buf)
Expand All @@ -127,7 +127,7 @@ unsigned short WzHack_GetWarzoneVersion(const char *wz_filename)

BOOL WzHack_GetStructStartIndex(int wz_version, unsigned short *start)
{
unsigned short local_start;
unsigned short local_start = 0;
BOOL bOk = FALSE;
const size_t len = arraySize(player_info);

Expand Down Expand Up @@ -404,6 +404,7 @@ uint32_t GetWarzoneMaxPowerValue(int warzone_version)
case WZ_340:
case WZ_341:
case WZ_400:
case WZ_401:
return 1000000;
}

Expand Down
19 changes: 17 additions & 2 deletions src/wzhack.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define WZ_340 340
#define WZ_341 341
#define WZ_400 400
#define WZ_401 401
#define WZ_UNKNOWN 0xFFF

// Retorna o número de elementos de um array 2D
Expand Down Expand Up @@ -98,7 +99,8 @@ typedef enum GAME_FEATURES
static const struct game_status gstatus[] =
{
{ 0x3b1b88, 0x39ce38, WZ_341 },
{ 0x51a7c8, 0x5058f0, WZ_400 }
{ 0x51a7c8, 0x5058f0, WZ_400 },
{ 0x51a7c8, 0x5058f0, WZ_401}
};

// power_offset + max_power_offset = energia máxima
Expand Down Expand Up @@ -195,7 +197,20 @@ static const struct player player_info[] =
{ 7, 0, 0, 0, 0x920834, 0, 0, 0, 0, 0, WZ_400},
{ 8, 0, 0, 0, 0x920864, 0, 0, 0, 0, 0, WZ_400},
{ 9, 0, 0, 0, 0x920894, 0, 0, 0, 0, 0, WZ_400},
{ 10, 0, 0, 0, 0x9208c4, 0, 0, 0, 0, 0, WZ_400}
{ 10, 0, 0, 0, 0x9208c4, 0, 0, 0, 0, 0, WZ_400},

// Warzone 2100 4.0.1
{0, 0, 0, 0, 0x9206e4, 0, 0, 0, 0, 0, WZ_401},
{1, 0, 0, 0, 0x920714, 0, 0, 0, 0, 0, WZ_401},
{2, 0, 0, 0, 0x920744, 0, 0, 0, 0, 0, WZ_401},
{3, 0, 0, 0, 0x920774, 0, 0, 0, 0, 0, WZ_401},
{4, 0, 0, 0, 0x9207a4, 0, 0, 0, 0, 0, WZ_401},
{5, 0, 0, 0, 0x9207d4, 0, 0, 0, 0, 0, WZ_401},
{6, 0, 0, 0, 0x920804, 0, 0, 0, 0, 0, WZ_401},
{7, 0, 0, 0, 0x920834, 0, 0, 0, 0, 0, WZ_401},
{8, 0, 0, 0, 0x920864, 0, 0, 0, 0, 0, WZ_401},
{9, 0, 0, 0, 0x920894, 0, 0, 0, 0, 0, WZ_401},
{10, 0, 0, 0, 0x9208c4, 0, 0, 0, 0, 0, WZ_401}
};

/**
Expand Down

0 comments on commit 598b932

Please sign in to comment.