Commit 842af877 authored by nanahira's avatar nanahira

Testify

parent 2de6677a
Pipeline #24512 passed with stages
in 7 minutes and 17 seconds
......@@ -53,9 +53,9 @@ class Base64 {
return (enc_len == out->size());
}
static bool Encode(const char *input, size_t input_length, char *out, size_t out_length) {
static bool Encode(const unsigned char *input, size_t input_length, unsigned char *out, size_t out_length) {
int i = 0, j = 0;
char *out_begin = out;
unsigned char *out_begin = out;
unsigned char a3[3];
unsigned char a4[4];
......@@ -148,9 +148,9 @@ class Base64 {
return (dec_len == out->size());
}
static bool Decode(const char *input, size_t input_length, char *out, size_t out_length) {
static bool Decode(const unsigned char *input, size_t input_length, unsigned char *out, size_t out_length) {
int i = 0, j = 0;
char *out_begin = out;
unsigned char *out_begin = out;
unsigned char a3[3];
unsigned char a4[4];
......@@ -198,10 +198,10 @@ class Base64 {
return (out == (out_begin + decoded_length));
}
static int DecodedLength(const char *in, size_t in_length) {
static int DecodedLength(const unsigned char *in, size_t in_length) {
int numEq = 0;
const char *in_end = in + in_length;
const unsigned char *in_end = in + in_length;
while (*--in_end == '=') ++numEq;
return ((6 * in_length) / 8) - numEq;
......
......@@ -233,9 +233,9 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->wDeckCode->setText(dataManager.GetSysString(1387));
if(deckManager.current_deck.main.size() > 0 || deckManager.current_deck.extra.size() > 0 || deckManager.current_deck.side.size() > 0) {
wchar_t deck_code[2048];
char deck_code_utf8[1024];
unsigned char deck_code_utf8[1024];
deckManager.SaveDeckToCode(deckManager.current_deck, deck_code_utf8);
BufferIO::DecodeUTF8(deck_code_utf8, deck_code);
BufferIO::DecodeUTF8((char*)deck_code_utf8, deck_code);
mainGame->ebDeckCode->setText(deck_code);
} else
mainGame->ebDeckCode->setText(L"");
......@@ -249,9 +249,9 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->HideElement(mainGame->wDeckCode);
if(prev_operation == BUTTON_DECK_CODE) {
Deck new_deck;
char deck_code[1024];
BufferIO::EncodeUTF8(mainGame->ebDeckCode->getText(), deck_code);
if(deckManager.LoadDeckFromCode(new_deck, deck_code, strlen(deck_code)))
unsigned char deck_code[1024];
BufferIO::EncodeUTF8(mainGame->ebDeckCode->getText(), (char*)deck_code);
if(deckManager.LoadDeckFromCode(new_deck, deck_code, strlen((char*)deck_code)))
deckManager.current_deck = new_deck;
else
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1389));
......
......@@ -358,8 +358,8 @@ int DeckManager::TypeCount(std::vector<code_pointer> list, unsigned int ctype) {
}
return res;
}
bool DeckManager::LoadDeckFromCode(Deck& deck, const char *code, int len) {
char data[1024], *pdeck = data, *data_ = data;
bool DeckManager::LoadDeckFromCode(Deck& deck, const unsigned char *code, int len) {
unsigned char data[1024], *pdeck = data, *data_ = data;
int decoded_len = Base64::DecodedLength(code, len);
if(decoded_len > 1024 || decoded_len < 8 || !Base64::Decode(code, len, data_, decoded_len))
return false;
......@@ -368,8 +368,8 @@ bool DeckManager::LoadDeckFromCode(Deck& deck, const char *code, int len) {
int errorcode = LoadDeck(deck, (int*)pdeck, mainc, sidec);
return (errorcode == 0);
}
int DeckManager::SaveDeckToCode(Deck& deck, char* code) {
char deckbuf[1024], *pdeck = deckbuf;
int DeckManager::SaveDeckToCode(Deck& deck, unsigned char* code) {
unsigned char deckbuf[1024], *pdeck = deckbuf;
BufferIO::WriteInt32(pdeck, deck.main.size() + deck.extra.size());
BufferIO::WriteInt32(pdeck, deck.side.size());
for(size_t i = 0; i < deck.main.size(); ++i)
......
......@@ -56,8 +56,8 @@ public:
bool DeleteDeck(const wchar_t* file);
wchar_t DeckFormatBuffer[128];
int TypeCount(std::vector<code_pointer> list, unsigned int ctype);
bool LoadDeckFromCode(Deck& deck, const char *code, int len);
int SaveDeckToCode(Deck &deck, char *code);
bool LoadDeckFromCode(Deck& deck, const unsigned char *code, int len);
int SaveDeckToCode(Deck &deck, unsigned char *code);
bool CreateCategory(const wchar_t* name);
bool RenameCategory(const wchar_t* oldname, const wchar_t* newname);
bool DeleteCategory(const wchar_t* name);
......
......@@ -226,7 +226,7 @@ bool Game::Initialize() {
SetWindowsIcon();
//main menu
wchar_t strbuf[256];
myswprintf(strbuf, L"KoishiPro %X.0%X.%X Tempestissimo", PRO_VERSION >> 12, (PRO_VERSION >> 4) & 0xff, PRO_VERSION & 0xf);
myswprintf(strbuf, L"KoishiPro %X.0%X.%X Testify", PRO_VERSION >> 12, (PRO_VERSION >> 4) & 0xff, PRO_VERSION & 0xf);
wMainMenu = env->addWindow(rect<s32>(370, 200, 650, 415), false, strbuf);
wMainMenu->getCloseButton()->setVisible(false);
btnLanMode = env->addButton(rect<s32>(10, 30, 270, 60), wMainMenu, BUTTON_LAN_MODE, dataManager.GetSysString(1200));
......
......@@ -80,10 +80,13 @@ struct DuelInfo {
bool isTag{ false };
bool isSingleMode{ false };
bool is_shuffling{ false };
bool is_swapped{ false };
bool tag_player[2]{ false };
bool isReplaySwapped{ false };
int lp[2]{ 0 };
int start_lp{ 0 };
int card_count[2]{ 0 };
int total_attack[2]{ 0 };
int duel_rule{ 0 };
int turn{ 0 };
short curMsg{ 0 };
......@@ -862,6 +865,7 @@ extern Game* mainGame;
#define TEXTURE_COVER_O 4
#define TEXTURE_ATTACK 5
#define TEXTURE_ACTIVATE 6
//STOC_GAME_MSG messages
#define MSG_WAITING 3
#define MSG_START 4
......
Subproject commit e94823b222461b300c20c27f8991c19ba2f06269
Subproject commit 9fd658759d2ea95814023f366712aca334ddbf9a
......@@ -16,8 +16,8 @@ VALUE "InternalName", "KoishiPro"
VALUE "LegalCopyright", "Copyright (C) 2023 Nanahira"
VALUE "OriginalFilename", "ygopro.exe"
VALUE "ProductName", "KoishiPro"
VALUE "FileVersion", "Tempestissimo"
VALUE "ProductVersion", "Tempestissimo"
VALUE "FileVersion", "Testify"
VALUE "ProductVersion", "Testify"
END
END
BLOCK "VarFileInfo"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment