Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clipboard data for retests #177

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"cmake.generator": "Ninja",
"cmake.sourceDirectory": "${workspaceFolder}",
"cmake.buildDirectory": "${workspaceFolder}/_build/_Release",
"cmake.configureArgs": [
// "-DBUILD_CORE=1",
"-DISDEBUG=1"
],
"cmake.configureSettings": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${workspaceFolder}/_build/_Install",
Expand Down
72 changes: 54 additions & 18 deletions tools/gamereport/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"It looks like we already know about the issues in this game!\n\n"
"Current status: {}\nPossible issues:\n{}\n\n"
"Do you want to open a game's issue page on GitHub?",
"Do you want to open a game's issue page on GitHub?\n"
"Report data will be copied to your clipboard.",

"nothing (the game don't initialize properly, not loading at all and/or crashing the emulator)",
"intro (the game display image but don't make it past the menus)",
Expand Down Expand Up @@ -137,7 +138,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"Похоже, что мы уже знаем о проблемах в этой игре!\n\n"
"Текущий статус: {}\nВозможные проблемы:\n{}\n\n"
"Хотите открыть страницу игры на GitHub?\n",
"Хотите открыть страницу игры на GitHub?\n"
"Данные о вашем тесте будут скопированы в буфер обмена.",

"nothing (игра не инициализируется правильно, не загружается вообще и/или крашит эмулятор)",
"intro (игра что-то рисует на экране, но уйти дальше главного меню не выходит)",
Expand Down Expand Up @@ -180,7 +182,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"Il semble que nous soyons déjà au courant des problèmes de ce jeu !\n\n"
"État actuel : {}\nProblèmes possibles :\n{}\n\n"
"Voulez-vous ouvrir la page des problèmes d'un jeu sur GitHub ?",
"Voulez-vous ouvrir la page des problèmes d'un jeu sur GitHub ?\n"
"Report data will be copied to your clipboard.",

"nothing (le jeu ne s'initialise pas correctement, ne se charge pas du tout et/ou plante l'émulateur)",
"intro (l'image du jeu affiche mais ne dépasse pas les menus)",
Expand Down Expand Up @@ -223,7 +226,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"Es scheint, als wären uns die Probleme in diesem Spiel bereits bekannt!\n\n"
"Aktueller Status: {}\nMögliche Probleme:\n{}\n\n"
"Möchtest du eine Fehlerseite für ein Spiel auf GitHub öffnen?",
"Möchtest du eine Fehlerseite für ein Spiel auf GitHub öffnen?\n"
"Report data will be copied to your clipboard.",

"nothing (Das Spiel initialisiert nicht richtig, es lädt nicht und/oder lässt den Emulator abstürzen)",
"intro (Das Spiel zeigt ein Bild, kommt jedoch nicht weiter als Menüs)",
Expand Down Expand Up @@ -266,7 +270,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"Se ha detectado un fallo en la emulación!\n\n"
"Estado actual: {}\nPosibles fallos:\n{}\n\n"
"Deseas abrir el reporte de compatibilidad del juego?",
"Deseas abrir el reporte de compatibilidad del juego?\n"
"Los datos de reporte se copiarán a tu portapapeles.",

"nothing (el juego no carga y/o se cuelga el emulador)",
"intro (el juego produce imagen pero no funciona más allá del menú)",
Expand Down Expand Up @@ -309,7 +314,8 @@ static const char* strings[LANGS_MAX][LANG_STR_MAX] = {
/* Issues window */
"Wydaje się, że już znamy problemy z tą grą!\n\n"
"Obecny status: {}\nMożliwe problemy:\n{}\n\n"
"Czy chcesz otworzyć zgłoszony raport gry na Github?",
"Czy chcesz otworzyć zgłoszony raport gry na Github?\n"
"Report data will be copied to your clipboard.",

"nic (gra nie uruchamia się poprawnie, w ogóle się nie wczytuje i/lub powoduje awarię emulatora)",
"intro (gra wyświetla obraz, ale nie przechodzi dalej niż menu)",
Expand Down Expand Up @@ -578,26 +584,56 @@ void GameReport::ShowReportWindow(const Info& info) {

boost::urls::url link("https://github.com/");

auto extver = std::format("{}: {}", git::Branch(), git::CommitSHA1());
const char* emuver = nullptr;
const char* descr = nullptr;

if (git::Branch() == "main") {
emuver = info.emu_ver;
} else {
emuver = extver.data();
}

switch (info.type) {
case EXCEPTION:
descr = info.add.ex->what(); // todo: add stack trace?
break;
case MISSING_SYMBOL:
descr = info.add.message; // todo: some formatting?
break;

default:
descr = ""; //
break;
}

if (issue.id == -1) {
link.set_path(std::format("/{}/issues/new", GAMEREPORT_REPO_NAME));
auto params = link.params();
params.append({"template", "game_report.yml"});
switch (info.type) {
case EXCEPTION:
params.append({"what-happened", info.add.ex->what()}); // todo: add stack trace?
break;
case MISSING_SYMBOL:
params.append({"what-happened", info.add.message}); // todo: some formatting?
break;

default: break;
}
params.append({"what-happened", descr});
params.append({"title", std::format("[{}]: {}", info.title_id, info.title)});
params.append({"game-version", info.app_ver});
params.append({"emu-version", info.emu_ver});
params.append({"lib-version", git::CommitSHA1().data()});
params.append({"emu-version", emuver});
} else {

link.set_path(std::format("/{}/issues/{}", GAMEREPORT_REPO_NAME, issue.id));
std::string output = std::format("Retested with `{}`\n\n### Please, describe what you get\n\n{}\n\n"
"### Game version you are using\n\n{}\n\n"
"### Current game status\n\nNothing\n\n"
"### Upload your log there\n\nNo logs :(\n\n"
"### Upload your screenshots there\n\nNo screenshots :(\n\n",
emuver, descr, info.app_ver);

auto strlen = output.size() + 1;
HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, strlen);
::memcpy(GlobalLock(hMem), output.c_str(), strlen);
::GlobalUnlock(hMem);
::OpenClipboard(nullptr);
::EmptyClipboard();
::SetClipboardData(CF_TEXT, hMem);
::CloseClipboard();
::GlobalFree(hMem);
}

ShellExecuteA(nullptr, nullptr, link.normalize().c_str(), nullptr, nullptr, SW_SHOW);
Expand Down
Loading