Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #75 from igor725/features
Browse files Browse the repository at this point in the history
Rework GameReport a bit
  • Loading branch information
SysRay authored Apr 10, 2024
2 parents 1da2439 + 7ee2164 commit 1acaf8d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 25 deletions.
4 changes: 4 additions & 0 deletions modules/libSceLibcInternal/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ EXPORT SYSV_ABI int __NID(setjmp)(unwinding_jmp_buf* jb) {
return 0;
}

EXPORT SYSV_ABI int __NID(gmtime_s)(tm* tm, const time_t* time) {
return ::gmtime_s(tm, time);
}

EXPORT SYSV_ABI int __NID(__cxa_guard_acquire)(uint64_t* guard_object) {
LOG_USE_MODULE(libSceLibcInternal);
LOG_ERR(L"todo %S", __FUNCTION__);
Expand Down
25 changes: 20 additions & 5 deletions modules/libSceNgs2/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,16 @@ static int32_t ParseRIFF(const uint8_t* data, size_t size, SceNgs2WaveformFormat
// wf->numBlocks = 1;
// wf->block[0].userData = (uintptr_t)frames;

// av_free(avioctx);
// avformat_close_input(&fmtctx);
av_free(avioctx);
avformat_close_input(&fmtctx);

return Ok;
}

static int32_t ParseVAG(const uint8_t* data, size_t size, SceNgs2WaveformFormat* wf) {
return Err::INVALID_WAVEFORM_DATA;
}

static int32_t ProcessWaveData(WaveformInfo* wi, SceNgs2WaveformFormat* wf) {
LOG_USE_MODULE(libSceNgs2);

Expand All @@ -163,7 +167,10 @@ static int32_t ProcessWaveData(WaveformInfo* wi, SceNgs2WaveformFormat* wf) {
case 0x46464952: // RIFF audio
return ParseRIFF((const uint8_t*)wi->ud.dataPtr, wi->size, wf);

default: LOG_CRIT(L"Unimplemented filetype: %08x", ftype);
case 0x70474156: // VAG audio
return ParseVAG((const uint8_t*)wi->ud.dataPtr, wi->size, wf);

default: LOG_ERR(L"Unimplemented filetype: %08x", ftype);
}
break;

Expand All @@ -190,7 +197,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformData(const void* ptr, size_t size, S
LOG_TRACE(L"todo %S", __FUNCTION__);

if (ptr == nullptr) {
return Err::INVALID_WAVEFORM_DATA;
return Err::INVALID_BUFFER_ADDRESS;
}

WaveformInfo wi {
Expand Down Expand Up @@ -228,7 +235,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformUser(SceWaveformUserFunc* user, size
LOG_ERR(L"todo %S", __FUNCTION__);

if (user == nullptr) {
return Err::INVALID_WAVEFORM_DATA;
return Err::INVALID_BUFFER_ADDRESS;
}

WaveformInfo wi {
Expand Down Expand Up @@ -267,6 +274,14 @@ EXPORT SYSV_ABI int32_t sceNgs2RackGetVoiceHandle(SceNgs2Handle* rh, uint32_t vo
return Ok;
}

EXPORT SYSV_ABI int32_t sceNgs2RackLock(SceNgs2Handle* rh) {
return Ok;
}

EXPORT SYSV_ABI int32_t sceNgs2RackUnlock(SceNgs2Handle* rh) {
return Ok;
}

EXPORT SYSV_ABI int32_t sceNgs2SystemCreateWithAllocator(SceNgs2SystemOption* sysopt, SceNgs2BufferAllocator* alloc, SceNgs2Handle** outh) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S(%p, %p, %p)", __FUNCTION__, sysopt, alloc, outh);
Expand Down
61 changes: 41 additions & 20 deletions tools/gamereport/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,33 @@ LOG_DEFINE_MODULE(GameReport)
namespace {
struct GitHubIssue {
int id;
std::string labels;
std::string status;
std::string descr;
};

static std::unordered_map<std::string, const char*> descrs = {
{"issues-audio", "* audio issues (sound is missing, choppy or playing incorrectly);\n"},
{"issues-graphics", "* graphics issues (visual artifacts, low framerate, black screen);\n"},
{"issues-input", "* input issues (gamepad/keyboard won't work, inpust lag is present);\n"},
{"audio", "* audio issues (sound is missing, choppy or playing incorrectly);\n"},
{"graphics", "* graphics issues (visual artifacts, low framerate, black screen);\n"},
{"input", "* input issues (gamepad/keyboard won't work, inpust lag is present);\n"},
{"savedata", "* savedata issues (the game won't save your progress);\n"},
{"issues-video", "* video issues (ingame videos are decoded incorrectly or not played at all);\n"},
{"video", "* video issues (ingame videos are decoded incorrectly or not played at all);\n"},
{"missing-symbol", "* missing symbol (the game needs functions that we have not yet implemented);\n"},
{"nvidia-specific", "* nvidia specific (the game has known issues on NVIDIA cards);\n"},
};

static std::unordered_map<std::string, const char*> statuses = {
{"status-nothing", "nothing (the game don't initialize properly, not loading atall and/or crashing the emulator)"},
{"status-intro", "intro (the game display image but don't make it past the menus)"},
{"status-ingame", "igname (the game can't be either finished, have serious glitches or insufficient performance)"},
{"status-playable", "playable (the game can be finished with playable performance and no game breaking glitches)"},
};

static const char* retrieve_label_status(std::string& label) {
auto it = statuses.find(label);
if (it != statuses.end()) return it->second;
return nullptr;
};

static const char* retrieve_label_description(std::string& label) {
auto it = descrs.find(label);
if (it != descrs.end()) return it->second;
Expand All @@ -51,7 +64,7 @@ static int find_issue(const char* title_id, GitHubIssue* issue) {
boost::urls::url link("https://api.github.com/search/issues");

auto params = link.params();
params.append({"q", std::format("repo:SysRay/psOff_compatibility is:issue {} in:title", title_id)});
params.append({"q", std::format("repo:{} is:issue {} in:title", GAMEREPORT_REPO_NAME, title_id)});
link.normalize();

io_service svc;
Expand Down Expand Up @@ -89,11 +102,10 @@ static int find_issue(const char* title_id, GitHubIssue* issue) {
std::string tempstr;
for (auto it: jlabels) {
it["name"].get_to(tempstr);
issue->labels += tempstr + ", ";

if (auto gstat = retrieve_label_status(tempstr)) issue->status = gstat;
if (auto descr = retrieve_label_description(tempstr)) issue->descr += descr;
}
if (auto len = issue->labels.length()) issue->labels.erase(len - 2);
if (auto len = issue->descr.length()) issue->descr.erase(len - 2);
jissue["number"].get_to(issue->id);
} catch (json::exception& ex) {
Expand Down Expand Up @@ -137,7 +149,7 @@ void GameReport::ShowReportWindow(const Info& info) {

case EXCEPTION:
case MISSING_SYMBOL:
message = "Looks like your emulator just crashed! Do you want to file a game report?\n"
message = "We believe your emulator just crashed! Do you want to file a game report?\n"
"If you press \"Yes\", your default browser will be opened.\n\n"
"You must have a GitHub account to create an issue!";
break;
Expand All @@ -159,6 +171,15 @@ void GameReport::ShowReportWindow(const Info& info) {
.buttons = btns,
};

int btn = -1;

if (SDL_ShowMessageBox(&mbd, &btn) != 0) {
LOG_ERR(L"[gamereport] Failed to generate SDL MessageBox: %S", SDL_GetError());
return;
}

if (btn != 1) return;

GitHubIssue issue {
.id = -1,
};
Expand All @@ -167,21 +188,19 @@ void GameReport::ShowReportWindow(const Info& info) {

if (find_issue(info.title_id, &issue) == 0) {
issue_msg = std::format("Looks like we already know about issue(-s) in this game!\n\n"
"Issue ID: {}\nIssue labels: {}\nPossible issues:\n{}\n\n"
"Game status: {}\nPossible issues:\n{}\n\n"
"Do you want to open issue's page?",
issue.id, issue.labels, issue.descr);
issue.status, issue.descr);
mbd.message = issue_msg.c_str();
}

int btn = -1;
if (SDL_ShowMessageBox(&mbd, &btn) != 0) {
LOG_ERR(L"[gamereport] Failed to generate SDL MessageBox: %S", SDL_GetError());
return;
}

if (SDL_ShowMessageBox(&mbd, &btn) != 0) {
LOG_ERR(L"[gamereport] Failed to generate SDL MessageBox: %S", SDL_GetError());
return;
if (btn != 1) return;
}

if (btn != 1) return;

try {
std::string str;
auto [lock, jData] = accessConfig()->accessModule(ConfigModFlag::LOGGING);
Expand All @@ -206,11 +225,13 @@ void GameReport::ShowReportWindow(const Info& info) {
if (btn != 1) return;
}
} catch (const json::exception& ex) {
LOG_ERR(L"Something off with the logging configuration: %S", ex.what());
}

boost::urls::url link("https://github.com/SysRay/psOff_compatability/issues/new");
boost::urls::url link("https://github.com/");

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) {
Expand All @@ -227,7 +248,7 @@ void GameReport::ShowReportWindow(const Info& info) {
params.append({"game-version", info.app_ver});
params.append({"lib-version", git::CommitSHA1().data()});
} else {
link.set_path(std::format("/SysRay/psOff_compatibility/issues/{}", issue.id));
link.set_path(std::format("/{}/issues/{}", GAMEREPORT_REPO_NAME, issue.id));
}

ShellExecuteA(nullptr, nullptr, link.normalize().c_str(), nullptr, nullptr, SW_SHOW);
Expand Down
2 changes: 2 additions & 0 deletions tools/gamereport/gamereport.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "utility/utility.h"

#define GAMEREPORT_USER_SEND_SCANCODE SDL_SCANCODE_F11
#define GAMEREPORT_REPO_NAME "SysRay/psOff_compatibility"

class IGameReport {
CLASS_NO_COPY(IGameReport);
Expand All @@ -26,6 +27,7 @@ class IGameReport {
union AdditionalData {
std::exception* ex;
const char* message;
const void* ptr;
};

struct Info {
Expand Down

0 comments on commit 1acaf8d

Please sign in to comment.