mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
parse the crash printer path from config file
This commit is contained in:
parent
6efc5b5e8e
commit
0358bcae89
@ -1,3 +1,8 @@
|
||||
* added a very basic crashes logger/printer, enabled by creating a file called `crash_printer_location.txt` inside the `steam_settings` folder,
|
||||
check README.realease.md for more details
|
||||
|
||||
---
|
||||
|
||||
## 2024/1/5
|
||||
|
||||
* **[Detanup01]** Fixed parsing of old Steam interfaces, reported by **[LuKeStorm]**: https://cs.rin.ru/forum/viewtopic.php?p=2971639#p2971639
|
||||
|
@ -98,6 +98,8 @@
|
||||
#include "detours/detours.h"
|
||||
#endif
|
||||
|
||||
#include "crash_printer/win.hpp"
|
||||
|
||||
// Convert a wide Unicode string to an UTF8 string
|
||||
static inline std::string utf8_encode(const std::wstring &wstr)
|
||||
{
|
||||
@ -149,6 +151,8 @@ static inline void reset_LastError()
|
||||
#include <dlfcn.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include "crash_printer/linux.hpp"
|
||||
|
||||
#define PATH_MAX_STRING_SIZE 512
|
||||
#define PATH_SEPARATOR "/"
|
||||
#define utf8_decode(a) a
|
||||
@ -236,6 +240,17 @@ static std::string uint8_vector_to_hex_string(std::vector<uint8_t>& v)
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void consume_bom(std::ifstream &input)
|
||||
{
|
||||
int bom[3];
|
||||
bom[0] = input.get();
|
||||
bom[1] = input.get();
|
||||
bom[2] = input.get();
|
||||
if (bom[0] != 0xEF || bom[1] != 0xBB || bom[2] != 0xBF) {
|
||||
input.seekg(-3, std::ios::cur);
|
||||
}
|
||||
}
|
||||
|
||||
// Emulator includes
|
||||
// add them here after the inline functions definitions
|
||||
#include "net.pb.h"
|
||||
@ -261,4 +276,6 @@ static std::string uint8_vector_to_hex_string(std::vector<uint8_t>& v)
|
||||
|
||||
#define LOBBY_CONNECT_APPID ((uint32)-2)
|
||||
|
||||
constexpr const char * const whitespaces = " \t\r\n";
|
||||
|
||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
||||
|
@ -17,17 +17,6 @@
|
||||
|
||||
#include "dll/settings_parser.h"
|
||||
|
||||
static void consume_bom(std::ifstream &input)
|
||||
{
|
||||
int bom[3];
|
||||
bom[0] = input.get();
|
||||
bom[1] = input.get();
|
||||
bom[2] = input.get();
|
||||
if (bom[0] != 0xEF || bom[1] != 0xBB || bom[2] != 0xBF) {
|
||||
input.seekg(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void load_custom_broadcasts(std::string broadcasts_filepath, std::set<IP_PORT> &custom_broadcasts)
|
||||
{
|
||||
PRINT_DEBUG("Broadcasts file path: %s\n", broadcasts_filepath.c_str());
|
||||
@ -773,7 +762,6 @@ static void parse_force_branch_name(class Settings *settings_client, Settings *s
|
||||
std::string line;
|
||||
getline( input, line );
|
||||
|
||||
constexpr const char * const whitespaces = " \t\r\n";
|
||||
size_t start = line.find_first_not_of(whitespaces);
|
||||
size_t end = line.find_last_not_of(whitespaces);
|
||||
line = start == end
|
||||
@ -953,6 +941,33 @@ static void parse_build_id(int &build_id, std::string &steam_settings_path)
|
||||
}
|
||||
}
|
||||
|
||||
// crash_printer_location.txt
|
||||
static void parse_crash_printer_location()
|
||||
{
|
||||
std::string installed_apps_list_path = Local_Storage::get_game_settings_path() + "crash_printer_location.txt";
|
||||
std::ifstream input( utf8_decode(installed_apps_list_path) );
|
||||
if (input.is_open()) {
|
||||
consume_bom(input);
|
||||
std::string line;
|
||||
std::getline( input, line );
|
||||
|
||||
size_t start = line.find_first_not_of(whitespaces);
|
||||
size_t end = line.find_last_not_of(whitespaces);
|
||||
line = start == end
|
||||
? std::string()
|
||||
: line.substr(start, end - start + 1);
|
||||
|
||||
if (!line.empty()) {
|
||||
auto crash_path = utf8_decode(get_full_program_path() + line);
|
||||
if (crash_printer::init(crash_path)) {
|
||||
PRINT_DEBUG("Unhandled crashes will be saved to '%s'\n", line.c_str());
|
||||
} else {
|
||||
PRINT_DEBUG("Failed to setup unhandled crash printer with path: '%s'\n", line.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out)
|
||||
{
|
||||
std::string program_path = Local_Storage::get_program_path();
|
||||
@ -960,6 +975,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
|
||||
|
||||
PRINT_DEBUG("Current Path %s save_path: %s\n", program_path.c_str(), save_path.c_str());
|
||||
|
||||
parse_crash_printer_location();
|
||||
|
||||
uint32 appid = parse_steam_app_id(program_path);
|
||||
|
||||
bool local_save = parse_local_save(program_path, save_path);
|
||||
|
@ -364,6 +364,20 @@ Check the relevant files `is_beta_branch.txt` and `force_branch_name.txt` in the
|
||||
|
||||
---
|
||||
|
||||
## Crash log/printer:
|
||||
|
||||
The emu can setup a very basic crash logger/printer.
|
||||
This is intended to debug some annoying scenarios, and best used with the debug build of the emu.
|
||||
|
||||
To enable this feature create a file called `crash_printer_location.txt` inside your `steam_settings` folder,
|
||||
and set the path to the crash log file on a single line.
|
||||
|
||||
Note that forward slashes `/` are encouraged for both Windows & Linux.
|
||||
|
||||
Check the example file `crash_printer_location.EXAMPLE.txt`
|
||||
|
||||
---
|
||||
|
||||
## Fake Windows dll/exe certificate and antivirus software:
|
||||
|
||||
The Windows build is signed with a fake self-signed certificate, this helps in bypassing some basic checks by apps,
|
||||
|
@ -0,0 +1 @@
|
||||
./path/relative/to/dll/crashes.txt
|
Loading…
Reference in New Issue
Block a user