Buildfixes

This commit is contained in:
Henrik Rydgård committed 2026-07-20 12:02:07 +02:00
1 parent a59637975a
commit 717ffc9fae
6 files changed
+59 -40

No files matched your search

+46 -34
View File
@@ -2,57 +2,69 @@
#include "Core/CmdLine.h"
#include "Common/StringUtils.h"
#ifdef HAVE_LIBRETRO_VFS
// Actually, this probably shouldn't be built at all for libretro! But let's add the guard.
#define PRINT_STDOUT(...) printf(__VA_ARGS__)
#define PRINT_STDERR(...) printf(__VA_ARGS__)
#else
#define PRINT_STDOUT(...) printf(__VA_ARGS__)
#define PRINT_STDERR(...) fprintf(stderr, __VA_ARGS__)
#endif
static int printUsage(int argc, const char *argv[]) {
// NOTE: by convention, --help outputs to stdout,
// not to stderr, since it is intended output in this
// case (usage printed under different circumstances,
// say in response to error during parsing commandline,
// may go to stderr).
FILE *dst = stdout;
const char *progname = argc > 0 ? argv[0] : "ppsspp";
// NOTE: wording largely taken from
// https://www.ppsspp.org/docs/reference/command-line/
fprintf(dst, "PPSSPP - a PSP emulator (SDL build)\n");
fprintf(dst, "Usage: %s [options] [FILE]\n\n", progname);
fprintf(dst, "Launches FILE (e.g. ISO image) if present.\n");
fprintf(dst, "Options (some of these are specific to SDL backend):\n");
fprintf(dst, " -h, --help show this message and exit\n");
fprintf(dst, " --version show version information and exit\n");
PRINT_STDOUT("PPSSPP - a PSP emulator (SDL build)\n");
PRINT_STDOUT("Usage: %s [options] [FILE]\n\n", progname);
PRINT_STDOUT("Launches FILE (e.g. ISO image) if present.\n");
PRINT_STDOUT("Options (some of these are specific to SDL backend):\n");
PRINT_STDOUT(" -h, --help show this message and exit\n");
PRINT_STDOUT(" --version show version information and exit\n");
fprintf(dst, " -d set the log level to debug\n");
fprintf(dst, " -v set the log level to verbose\n");
fprintf(dst, " --loglevel=INTEGER set the log level to specified value\n");
fprintf(dst, " --log=FILE output log to FILE\n");
fprintf(dst, " --state=FILE load state from FILE\n");
PRINT_STDOUT(" -d set the log level to debug\n");
PRINT_STDOUT(" -v set the log level to verbose\n");
PRINT_STDOUT(" --loglevel=INTEGER set the log level to specified value\n");
PRINT_STDOUT(" --log=FILE output log to FILE\n");
PRINT_STDOUT(" --state=FILE load state from FILE\n");
fprintf(dst, " -i use the interpreter\n");
fprintf(dst, " -r use IR interpreter\n");
fprintf(dst, " -j use JIT\n");
fprintf(dst, " -J use IR JIT\n");
PRINT_STDOUT(" -i use the interpreter\n");
PRINT_STDOUT(" -r use IR interpreter\n");
PRINT_STDOUT(" -j use JIT\n");
PRINT_STDOUT(" -J use IR JIT\n");
fprintf(dst, " --fullscreen force full screen mode, ignoring saved configuration\n");
fprintf(dst, " --windowed force windowed mode, ignoring saved configuration\n");
fprintf(dst, " --xres PIXELS set X resolution\n");
fprintf(dst, " --yres PIXELS set Y resolution\n");
fprintf(dst, " --dpi FACTOR set DPI\n");
fprintf(dst, " --scale FACTOR set scale\n");
fprintf(dst, " --ipad set resolution to 1024x768\n");
fprintf(dst, " --portrait portrait mode\n");
fprintf(dst, " --graphics=BACKEND use a different gpu backend\n");
fprintf(dst, " options: gles, software, etc. (also opengl3.1, etc.)\n");
PRINT_STDOUT(" --fullscreen force full screen mode, ignoring saved configuration\n");
PRINT_STDOUT(" --windowed force windowed mode, ignoring saved configuration\n");
PRINT_STDOUT(" --xres PIXELS set X resolution\n");
PRINT_STDOUT(" --yres PIXELS set Y resolution\n");
PRINT_STDOUT(" --dpi FACTOR set DPI\n");
PRINT_STDOUT(" --scale FACTOR set scale\n");
PRINT_STDOUT(" --ipad set resolution to 1024x768\n");
PRINT_STDOUT(" --portrait portrait mode\n");
PRINT_STDOUT(" --graphics=BACKEND use a different gpu backend\n");
PRINT_STDOUT(" options: gles, software, etc. (also opengl3.1, etc.)\n");
fprintf(dst, " --pause-menu-exit change \"Exit to menu\" in pause menu to \"Exit\"\n");
fprintf(dst, " --escape-exit escape key exits the application\n");
fprintf(dst, " --gamesettings go directly to settings\n");
fprintf(dst, " --touchscreentest go directly to the touchscreentest screen\n");
fprintf(dst, " --appendconfig=FILE merge config FILE into the current configuration\n");
PRINT_STDOUT(" --pause-menu-exit change \"Exit to menu\" in pause menu to \"Exit\"\n");
PRINT_STDOUT(" --escape-exit escape key exits the application\n");
PRINT_STDOUT(" --gamesettings go directly to settings\n");
PRINT_STDOUT(" --touchscreentest go directly to the touchscreentest screen\n");
PRINT_STDOUT(" --appendconfig=FILE merge config FILE into the current configuration\n");
return 0;
}
// Logging should be done with plain printf here.
// Error reporting is done with fprintf(stderr, ....).
// Error reporting is done with PRINT_STDERR(....).
// Actually might want to reconsider given Android...
CommandLineParseResult CommandLineOptions::Parse(int argc, const char *argv[]) {
constexpr std::string_view gpuBackendStr = "--graphics=";
@@ -74,7 +86,7 @@ CommandLineParseResult CommandLineOptions::Parse(int argc, const char *argv[]) {
bootFilename = std::string(argv[i]);
} else {
// Already have a filename.
fprintf(stderr, "Warning: Ignoring extra boot filename '%s'.\n", argv[i]);
PRINT_STDERR("Warning: Ignoring extra boot filename '%s'.\n", argv[i]);
}
}
+1 -1
View File
@@ -859,7 +859,7 @@ int main(int argc, char *argv[])
g_logManager.EnableOutput(LogOutput::Stdio);
CommandLineOptions cmdLineOptions;
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, argv);
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, (const char **)argv);
switch (parseResult) {
case CommandLineParseResult::Exit:
return 0;
+1 -1
View File
@@ -1390,7 +1390,7 @@ int main(int argc, char *argv[]) {
TimeInit();
CommandLineOptions cmdLineOptions;
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, argv);
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, (const char **)argv);
switch (parseResult) {
case CommandLineParseResult::Exit:
return 0;
+7 -2
View File
@@ -15,6 +15,7 @@
#include "Common/System/NativeApp.h"
#include "Common/System/System.h"
#include "Common/Log/LogManager.h"
#include "Core/CmdLine.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "Core/Core.h"
@@ -86,7 +87,8 @@ void App::InitialPPSSPP() {
// Since we don't have any async operation in `NativeInit`
// it's better to call it here
const char* argv[2] = { "fake", nullptr };
int argc = 1;
const char* argv[2] = { "ppsspp", nullptr };
std::string cacheFolder = ConvertWStringToUTF8(
std::wstring(winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path())
);
@@ -94,7 +96,10 @@ void App::InitialPPSSPP() {
// since launch parameters usually handled by `OnActivated`
// and `OnActivated` will be invoked later, even after `PPSSPP_UWPMain(..)`
// so we are handling launch cases using `LaunchItem`
NativeInit(1, argv, "", "", cacheFolder.c_str());
CommandLineOptions cmdLineOptions;
cmdLineOptions.Parse(argc, argv);
NativeInit(1, argv, cmdLineOptions, "", "", cacheFolder.c_str());
// Override backend, `DIRECT3D11` is the only way for UWP apps
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
+1
View File
@@ -30,6 +30,7 @@
#include "Core/System.h"
#include "Core/Loaders.h"
#include "Core/Config.h"
#include "Core/CmdLine.h"
#include "Windows/InputDevice.h"
#include "Windows/XinputDevice.h"
+3 -2
View File
@@ -14,6 +14,7 @@
#import "Common/Log.h"
#import "IAPManager.h"
#include "Core/Util/PathUtil.h"
#include "Core/CmdLine.h"
#import <AVFoundation/AVFoundation.h>
#include <string>
@@ -150,7 +151,7 @@ static NSString *ExtractGameInfoScheme(NSURL *url) {
}
CommandLineOptions cmdLineOptions;
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, argv);
CommandLineParseResult parseResult = cmdLineOptions.Parse(argc, (const char **)argv);
switch (parseResult) {
case CommandLineParseResult::Exit:
INFO_LOG(Log::System, "Command line parse said to exit - mobile, so ignoring.");
@@ -165,7 +166,7 @@ static NSString *ExtractGameInfoScheme(NSURL *url) {
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"];
NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL);
NativeInit(argc, (const char**)argv, cmdLineOptions, documentsPath.UTF8String, bundlePath.UTF8String, NULL);
// If we were cold-started by a library export request, serve it now that
// the config (and recent games list) has been loaded by NativeInit.