Move frame timing to the dedicated emulation thread and misc tweaks/fixes

* Imagine: Add API for setting frame timer events in Window and Screen classes to a different thread
* Imagine: Clean up FDEventSource, Timer and various related APIs
* Imagine: Enable unused parameter/function/variable warnings and fix related warnings
* Imagine: Simplify MenuItem text alignment code
* Imagine: Run java Looper in EventLoop::run() instead of the native one if it exists
* Imagine: Run a single iteration of ALooper_pollOnce() in EventLoop::run() to ensure loop condition is checked properly
* Imagine: Post next frame in Screen::runOnFrameDelegates() before running delegates
* Imagine: Add support for indirectly writing to a Gfx::MappedBuffer in case it could be in use by the GPU
* Imagine: Update gradle to 8.9 and plugin to 8.5
* EmuFramework: Run the frame timer in EmuSystemTask's thread to simplify code and reduce jitter
* EmuFramework: Add headings to system options menu
* EmuFramework: Remove syncEmulationThread() and replace with suspendEmulationThread() API
* EmuFramework: Simplify FrameTimeStats
* EmuFramework: Fix incorrect remove_if() usage in KeyConfig::set()
* NES.emu, PCE.emu, Snes9x: Fix incorrect multitap gamepad key categories
* Lynx.emu: Add .lyx to recognized extensions
This commit is contained in:
Robert Broglia 2024-07-21 04:13:43 -04:00
parent 5060e6de41
commit 3f0c38cba8
262 changed files with 1574 additions and 1509 deletions

View File

@ -13,6 +13,8 @@ CPPFLAGS += -I$(projectPath)/src \
-I$(projectPath)/src/stella/common/tv_filters \
-I$(projectPath)/src/stella/gui
CFLAGS_WARN += -Wno-unused-parameter
stellaSrc := AtariVox.cxx \
Bankswitch.cxx \
Booster.cxx \

View File

@ -111,13 +111,13 @@ void SoundEmuEx::setEmuAudio(EmuEx::EmuAudio *audio)
[this, audio](AudioQueue &queue, uInt32 fragFrames)
{
const int samplesPerFrame = 1; //audioQueue->isStereo() ? 2 : 1;
const int fragSamples = fragFrames * samplesPerFrame;
int wroteFrames = 0;
[[maybe_unused]] const int fragSamples = fragFrames * samplesPerFrame;
[[maybe_unused]] int wroteFrames = 0;
//logDMsg("%d fragments of %d size ready", audioQueue->size(), fragFrames);
while(queue.size())
{
float buffF[512];
assert(fragSamples <= std::size(buffF));
assert(fragSamples <= std::ssize(buffF));
myResampler->fillFragment(buffF, fragFrames);
if(audio)
{

View File

@ -6,7 +6,7 @@ include $(IMAGINE_PATH)/make/imagineAppBase.mk
viceSrcPath := $(projectPath)/src/vice
CFLAGS_LANG += -Werror=implicit-function-declaration
CFLAGS_WARN += -Wno-implicit-fallthrough -Wno-sign-compare
CFLAGS_WARN += -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function
ifeq ($(ENV),android)
LDLIBS += -ldl

View File

@ -542,11 +542,6 @@ AssetDesc C64App::vControllerAssetDesc(KeyInfo key) const
}
}
static bool isEmuKeyInKeyboardRange(KeyCode emuKey)
{
return emuKey >= KeyCode(C64Key::KeyboardFirstEnum) && emuKey <= KeyCode(C64Key::KeyboardLastEnum);
}
VController::KbMap C64System::vControllerKeyboardMap(VControllerKbMode mode)
{
static constexpr VController::KbMap kbToEventMap =
@ -691,7 +686,7 @@ void C64System::handleInputAction(EmuApp *app, InputAction a)
if(app)
{
log.info("pushed restore key");
app->syncEmulationThread();
auto emuThreadResumer = app->suspendEmulationThread();
plugin.machine_set_restore_key(a.state == Input::Action::PUSHED);
}
break;

View File

@ -140,7 +140,6 @@ void C64System::resetCanvasSourcePixmap(struct video_canvas_s *c)
{
if(activeCanvas != c)
return;
unsigned canvasW = c->w;
unsigned canvasH = c->h;
if(optionCropNormalBorders && (canvasH == 247 || canvasH == 272))
{
@ -157,7 +156,6 @@ void C64System::resetCanvasSourcePixmap(struct video_canvas_s *c)
startX = xBorderSize; startY = xBorderSize;
}
int width = 320+(xBorderSize*2 - startX*2);
int widthPadding = startX*2;
canvasSrcPix = pixmapView(c).subView({startX, startY}, {width, height});
}
else

View File

@ -61,7 +61,7 @@ public:
auto &thisView = asThis(view);
fPicker->setPath(thisView.searchDir, e);
fPicker->setOnSelectPath(
[=](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event &e)
[=](FSPicker &picker, CStringView path, [[maybe_unused]] std::string_view displayName, const Input::Event&)
{
if(!onFileChange(path, FS::file_type::directory))
return;
@ -82,7 +82,7 @@ public:
archiveMode == ArchivePathSelectMode::include);
fPicker->setPath(thisView.searchDir, e);
fPicker->setOnSelectPath(
[=](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event &e)
[=](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event&)
{
if(mode == DataPathSelectMode::Folder && !EmuApp::hasArchiveExtension(displayName))
{

View File

@ -198,8 +198,8 @@ public:
void readState(std::span<uint8_t> buff);
size_t writeState(std::span<uint8_t> buff, SaveStateFlags = {});
DynArray<uint8_t> saveState();
bool saveState(CStringView path);
bool saveStateWithSlot(int slot);
bool saveState(CStringView path, bool notify);
bool saveStateWithSlot(int slot, bool notify);
bool loadState(CStringView path);
bool loadStateWithSlot(int slot);
bool shouldOverwriteExistingState() const;
@ -218,7 +218,8 @@ public:
bool hasSavedSessionOptions();
void resetSessionOptions();
void deleteSessionOptions();
void syncEmulationThread();
[[nodiscard]]
EmuSystemTask::SuspendContext suspendEmulationThread();
void startAudio();
EmuViewController &viewController();
const EmuViewController &viewController() const;
@ -242,6 +243,10 @@ public:
void skipFrames(EmuSystemTaskContext, int frames, EmuAudio *);
bool skipForwardFrames(EmuSystemTaskContext, int frames);
void notifyWindowPresented();
void reportFrameWorkTime();
void addOnFrameDelayed();
void addOnFrame();
void removeOnFrame();
void renderSystemFramebuffer(EmuVideo &);
void renderSystemFramebuffer() { renderSystemFramebuffer(video); }
bool writeScreenshot(IG::PixmapView, CStringView path);
@ -328,6 +333,7 @@ public:
void postMessage(int secs, bool error, UTF16Convertible auto &&msg)
{
auto suspendCtx = suspendEmulationThread();
toastView().post(IG_forward(msg), secs, error);
}
@ -375,8 +381,9 @@ public:
[[no_unique_address]] IG::VibrationManager vibrationManager;
protected:
EmuSystemTask emuSystemTask{*this};
mutable Gfx::Texture assetBuffImg[wise_enum::size<AssetFileID>];
std::binary_semaphore framePresentedSem{0};
int savedAdvancedFrames{};
mutable Gfx::Texture assetBuffImg[wise_enum::size<AssetFileID>];
[[no_unique_address]] IG::Data::PixmapReader pixmapReader;
[[no_unique_address]] IG::Data::PixmapWriter pixmapWriter;
[[no_unique_address]] PerformanceHintManager perfHintManager;
@ -464,14 +471,10 @@ protected:
void saveSystemOptions(FileIO &);
bool allWindowsAreFocused() const;
void configureSecondaryScreens();
void addOnFrameDelayed();
void addOnFrame();
void removeOnFrame();
IG::OnFrameDelegate onFrameDelayed(int8_t delay);
void addOnFrameDelegate(IG::OnFrameDelegate);
void onFocusChange(bool in);
void configureAppForEmulation(bool running);
void reportFrameWorkTime();
};
// Global instance access if required by the emulated system, valid if EmuApp::needsGlobalInstance initialized to true

View File

@ -19,6 +19,7 @@
#include <imagine/thread/Thread.hh>
#include <imagine/time/Time.hh>
#include <imagine/util/variant.hh>
#include <imagine/util/ScopeGuard.hh>
namespace EmuEx
{
@ -32,16 +33,14 @@ class EmuApp;
class EmuSystemTask
{
public:
struct FrameParamsCommand
struct SuspendCommand {};
struct ExitCommand {};
struct SetWindowCommand
{
FrameParams params;
Window* winPtr;
};
struct FramePresentedCommand {};
struct PauseCommand {};
struct ExitCommand {};
using CommandVariant = std::variant<FrameParamsCommand, FramePresentedCommand, PauseCommand, ExitCommand>;
using CommandVariant = std::variant<SuspendCommand, ExitCommand, SetWindowCommand>;
class Command: public CommandVariant, public AddVisit
{
public:
@ -51,31 +50,58 @@ public:
struct CommandMessage
{
std::binary_semaphore *semPtr{};
Command command{PauseCommand{}};
std::binary_semaphore* semPtr{};
Command command{SuspendCommand{}};
void setReplySemaphore(std::binary_semaphore *semPtr_) { assert(!semPtr); semPtr = semPtr_; };
};
EmuSystemTask(EmuApp &);
void start();
void pause();
struct SuspendContext
{
SuspendContext() = default;
SuspendContext(EmuSystemTask* taskPtr):taskPtr{taskPtr} {}
SuspendContext(SuspendContext&& rhs) noexcept { *this = std::move(rhs); }
SuspendContext& operator=(SuspendContext&& rhs)
{
taskPtr = std::exchange(rhs.taskPtr, nullptr);
return *this;
}
void resume()
{
if(taskPtr)
std::exchange(taskPtr, nullptr)->resume();
}
~SuspendContext() { resume(); }
private:
EmuSystemTask* taskPtr{};
};
EmuSystemTask(EmuApp&);
void start(Window&);
[[nodiscard]]
SuspendContext setWindow(Window&);
[[nodiscard]]
SuspendContext suspend();
void stop();
void updateFrameParams(FrameParams);
void notifyFramePresented();
void sendVideoFormatChangedReply(EmuVideo &);
void sendFrameFinishedReply(EmuVideo &);
void sendVideoFormatChangedReply(EmuVideo&);
void sendFrameFinishedReply(EmuVideo&);
void sendScreenshotReply(bool success);
auto threadId() const { return threadId_; }
Window &window() { return *winPtr; }
private:
EmuApp &app;
Window *winPtr{};
MessagePort<CommandMessage> commandPort{"EmuSystemTask Command"};
std::thread taskThread;
ThreadId threadId_{};
FrameParams frameParams;
public:
bool framePending{};
std::binary_semaphore suspendSem{0};
bool isSuspended{};
void resume();
};
}

View File

@ -170,7 +170,7 @@ inline void writeOptionValueIfNotDefault(Writable auto &io, uint16_t key, const
writeOptionValue(io, key, val);
}
inline void writeOptionValueIfNotDefault(Writable auto &io, Unused auto const &p) {}
inline void writeOptionValueIfNotDefault(Writable auto&, Unused auto const&) {}
inline void writeOptionValueIfNotDefault(Writable auto &io, PropertyOption auto const &p)
{

View File

@ -34,7 +34,7 @@ public:
using IOUtilsBase::toFileStream;
OutSizeTracker(size_t *sizePtr): sizePtr{sizePtr} {}
ssize_t read(void *buff, size_t bytes, std::optional<off_t> offset = {}) { return 0; }
ssize_t read(void*, size_t, [[maybe_unused]] std::optional<off_t> offset = {}) { return 0; }
off_t seek(off_t offset, SeekMode mode)
{
@ -49,7 +49,7 @@ public:
std::span<uint8_t> map() { return {}; }
explicit operator bool() const { return sizePtr; }
ssize_t write(const void *buff, size_t bytes, std::optional<off_t> offset = {})
ssize_t write(const void*, size_t bytes, [[maybe_unused]] std::optional<off_t> offset = {})
{
currPos += bytes;
if(currPos > *sizePtr)

View File

@ -29,22 +29,16 @@ enum class FrameTimeStatEvent
{
startOfFrame,
startOfEmulation,
aboutToSubmitFrame,
aboutToPostDraw,
startOfDraw,
aboutToPresent,
endOfDraw,
waitForPresent,
endOfFrame,
};
struct FrameTimeStats
{
SteadyClockTimePoint startOfFrame{};
SteadyClockTimePoint startOfEmulation{};
SteadyClockTimePoint aboutToSubmitFrame{};
SteadyClockTimePoint aboutToPostDraw{};
SteadyClockTimePoint startOfDraw{};
SteadyClockTimePoint aboutToPresent{};
SteadyClockTimePoint endOfDraw{};
SteadyClockTimePoint waitForPresent{};
SteadyClockTimePoint endOfFrame{};
int missedFrameCallbacks{};
};

View File

@ -48,7 +48,10 @@ protected:
ConditionalMember<Config::envIsAndroid, BoolMenuItem> performanceMode;
ConditionalMember<Config::envIsAndroid && Config::DEBUG_BUILD, BoolMenuItem> noopThread;
ConditionalMember<Config::cpuAffinity, TextMenuItem> cpuAffinity;
StaticArrayList<MenuItem*, 30> item;
TextHeadingMenuItem autosaveHeading;
TextHeadingMenuItem rewindHeading;
TextHeadingMenuItem otherHeading;
StaticArrayList<MenuItem*, 33> item;
};
}

View File

@ -39,7 +39,7 @@ public:
auto &thisView = asThis(view);
fPicker->setPath(thisView.searchDir, e);
fPicker->setOnSelectPath(
[=](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event &e)
[=](FSPicker &picker, CStringView path, [[maybe_unused]] std::string_view displayName, const Input::Event&)
{
onPathChange(path);
picker.popTo();

View File

@ -154,7 +154,7 @@ public:
void draw(Gfx::RendererCommands &__restrict__) const;
int getInput(WPt c) const;
KeyInfo translateInput(int idx) const;
bool keyInput(VController &v, Gfx::Renderer &r, const Input::KeyEvent &e);
bool keyInput(VController&, const Input::KeyEvent&);
[[nodiscard]] WindowRect selectKey(int x, int y);
void selectKeyRel(int x, int y);
void unselectKey();
@ -162,8 +162,8 @@ public:
KeyInfo currentKey() const;
KeyInfo currentKey(int x, int y) const;
VControllerKbMode mode() const { return mode_; }
void setMode(EmuSystem &, Gfx::Renderer &, VControllerKbMode mode);
void cycleMode(EmuSystem &, Gfx::Renderer &);
void setMode(EmuSystem&, VControllerKbMode mode);
void cycleMode(EmuSystem&);
void applyMap(KbMap map);
void updateKeyboardMapping(EmuSystem &);
void setShiftActive(bool);
@ -440,7 +440,7 @@ public:
{
[&](VControllerDPad &e){ e.setShowBounds(r, on); },
[&](VControllerButtonGroup &e){ e.setShowBounds(on); },
[](auto &e){}
[](auto&){}
});
}
@ -448,7 +448,7 @@ public:
{
return visit(overloaded
{
[&](const VControllerDPad &e){ return LB2DO; },
[&](const VControllerDPad&){ return LB2DO; },
[](auto &e){ return e.layout.origin; }
});
}

View File

@ -33,8 +33,8 @@ AutosaveManager::AutosaveManager(EmuApp &app_):
saveTimer
{
defaultSaveFreq,
"AutosaveManager::autosaveTimer",
[this]()
{.debugLabel = "AutosaveManager::autosaveTimer"},
[this]
{
log.debug("running autosave timer");
save();
@ -151,7 +151,7 @@ bool AutosaveManager::deleteSlot(std::string_view name)
return false;
auto ctx = appContext();
if(!ctx.forEachInDirectoryUri(system().contentLocalSaveDirectory(name),
[this, ctx](const FS::directory_entry &e)
[ctx](const FS::directory_entry &e)
{
ctx.removeFileUri(e.path());
return true;

View File

@ -110,7 +110,7 @@ EmuApp::EmuApp(ApplicationInitParams initParams, ApplicationContext &ctx):
if(needsGlobalInstance)
gAppPtr = this;
ctx.setAcceptIPC(true);
onEvent = [this](ApplicationContext ctx, const ApplicationEvent& appEvent)
onEvent = [this](ApplicationContext, const ApplicationEvent& appEvent)
{
appEvent.visit(overloaded
{
@ -214,8 +214,8 @@ static void suspendEmulation(EmuApp &app)
void EmuApp::closeSystem()
{
showUI();
emuSystemTask.stop();
showUI();
system().closeRuntimeSystem(*this);
autosaveManager.resetSlot();
rewindManager.clear();
@ -380,7 +380,7 @@ static SteadyClockTime targetFrameTime(const Screen &s)
void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::ApplicationContext ctx)
{
auto appConfig = loadConfigFile(ctx);
loadConfigFile(ctx);
system().onOptionsLoaded();
loadSystemOptions();
updateLegacySavePathOnStoragePath(ctx, system());
@ -391,7 +391,7 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
applyOSNavStyle(ctx, false);
ctx.addOnResume(
[this](IG::ApplicationContext ctx, bool focused)
[this](IG::ApplicationContext, [[maybe_unused]] bool focused)
{
audio.manager.startSession();
audio.open();
@ -423,7 +423,7 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
IG::WindowConfig winConf{ .title = ctx.applicationName };
winConf.setFormat(windowDrawableConfig.pixelFormat);
ctx.makeWindow(winConf,
[this, appConfig](IG::ApplicationContext ctx, IG::Window &win)
[this](IG::ApplicationContext ctx, IG::Window &win)
{
renderer.initMainTask(&win, windowDrawableConfig);
textureBufferMode = renderer.validateTextureBufferMode(textureBufferMode);
@ -441,7 +441,6 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
{
vController.setKeyboardImage(asset(AssetID::keyboardOverlay));
}
auto &screen = *win.screen();
winData.viewController.placeElements();
winData.viewController.pushAndShow(makeView(viewAttach, ViewID::MAIN_MENU));
configureSecondaryScreens();
@ -457,7 +456,19 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
videoLayer.updateEffect(system(), videoEffectPixelFormat());
system().onFrameUpdate = [this](FrameParams params)
{
emuSystemTask.updateFrameParams(params);
bool renderingFrame = advanceFrames(params, &emuSystemTask);
if(params.isFromRenderer() && !renderingFrame)
{
renderingFrame = true;
emuSystemTask.window().drawNow();
}
if(renderingFrame)
{
record(FrameTimeStatEvent::waitForPresent);
framePresentedSem.acquire();
reportFrameWorkTime();
record(FrameTimeStatEvent::endOfFrame);
}
return true;
};
@ -468,8 +479,6 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
[&](const Input::Event& e) { return viewController().inputEvent(e); },
[&](const DrawEvent& e)
{
record(FrameTimeStatEvent::startOfDraw);
auto reportTime = scopeGuard([&]{ reportFrameWorkTime(); });
return viewController().drawMainWindow(win, e.params, renderer.task());
},
[&](const WindowSurfaceChangeEvent& e)
@ -534,7 +543,7 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
perfHintSession.updateTargetWorkTime(targetTime);
log.info("updated performance hint session with target time:{}", targetTime);
}
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
configFrameTime();
}
}
@ -645,9 +654,7 @@ bool EmuApp::advanceFrames(FrameParams frameParams, EmuSystemTask *taskPtr)
if(enableBlankFrameInsertion)
{
viewCtrl.drawBlankFrame = true;
if(taskPtr)
taskPtr->framePending = true;
win.postDraw(1);
win.drawNow();
return true;
}
return false;
@ -665,6 +672,10 @@ bool EmuApp::advanceFrames(FrameParams frameParams, EmuSystemTask *taskPtr)
{
frameInfo.advanced = 1;
}
if(frameInfo.advanced > 1)
{
doIfUsed(frameTimeStats, [&](auto &stats) { stats.missedFrameCallbacks+= frameInfo.advanced - 1; });
}
}
assumeExpr(frameInfo.advanced > 0);
// cap advanced frames if we're falling behind
@ -679,19 +690,11 @@ bool EmuApp::advanceFrames(FrameParams frameParams, EmuSystemTask *taskPtr)
}
record(FrameTimeStatEvent::startOfFrame, frameParams.timestamp);
record(FrameTimeStatEvent::startOfEmulation);
win.setDrawEventPriority(Window::drawEventPriorityLocked);
if(taskPtr)
taskPtr->framePending = true;
}
inputManager.turboActions.update(*this);
//log.debug("running {} frame(s), skip:{}", frameInfo.advanced, !videoPtr);
runFrames({taskPtr}, videoPtr, audioPtr, frameInfo.advanced);
if(!videoPtr)
{
reportFrameWorkTime();
return false;
}
return true;
inputManager.turboActions.update(*this);
return videoPtr;
}
IG::Viewport EmuApp::makeViewport(const IG::Window &win) const
@ -822,15 +825,12 @@ void EmuApp::startEmulation()
video.onFrameFinished = [&, &viewController = viewController()](EmuVideo&)
{
auto &win = viewController.emuWindow();
record(FrameTimeStatEvent::aboutToPostDraw);
win.setDrawEventPriority(1);
win.postDraw(1);
win.drawNow();
};
frameTimeStats = {};
emuSystemTask.start();
setCPUNeedsLowLatency(appContext(), true);
system().start(*this);
addOnFrameDelayed();
emuSystemTask.start(emuWindow());
setCPUNeedsLowLatency(appContext(), true);
}
void EmuApp::showUI(bool updateTopView)
@ -845,14 +845,12 @@ void EmuApp::showUI(bool updateTopView)
void EmuApp::pauseEmulation()
{
emuSystemTask.stop();
setCPUNeedsLowLatency(appContext(), false);
emuSystemTask.pause();
video.onFrameFinished = [](EmuVideo&){};
system().pause(*this);
setRunSpeed(1.);
videoLayer.setBrightnessScale(pausedVideoBrightnessScale);
emuWindow().setDrawEventPriority();
removeOnFrame();
}
bool EmuApp::hasArchiveExtension(std::string_view name)
@ -885,14 +883,14 @@ void EmuApp::reloadSystem(EmuSystemCreateParams params)
{
if(!system().hasContent())
return;
pauseEmulation();
viewController().popToSystemActionsMenu();
emuSystemTask.pause();
auto ctx = appContext();
try
{
system().createWithMedia({}, system().contentLocation(),
ctx.fileUriDisplayName(system().contentLocation()), params,
[](int pos, int max, const char *label){ return true; });
[](int, int, const char*){ return true; });
onSystemCreated();
if(autosaveManager.slotName() != noAutosaveName)
system().loadBackupMemory(*this);
@ -960,7 +958,6 @@ void EmuApp::createSystemWithMedia(IO io, CStringView path, std::string_view dis
auto loadProgressView = std::make_unique<LoadProgressView>(attachParams, e, onComplete);
auto &msgPort = loadProgressView->messagePort();
pushAndShowModalView(std::move(loadProgressView), e);
auto ctx = attachParams.appContext();
IG::makeDetachedThread(
[this, io{std::move(io)}, pathStr = FS::PathString{path}, nameStr = FS::FileString{displayName}, &msgPort, params]() mutable
{
@ -1024,7 +1021,7 @@ void EmuApp::setupStaticBackupMemoryFile(FileIO &io, std::string_view ext, size_
void EmuApp::readState(std::span<uint8_t> buff)
{
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
system().readState(*this, buff);
system().clearInputBuffers(viewController().inputView);
autosaveManager.resetTimer();
@ -1032,28 +1029,30 @@ void EmuApp::readState(std::span<uint8_t> buff)
size_t EmuApp::writeState(std::span<uint8_t> buff, SaveStateFlags flags)
{
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
return system().writeState(buff, flags);
}
DynArray<uint8_t> EmuApp::saveState()
{
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
return system().saveState();
}
bool EmuApp::saveState(CStringView path)
bool EmuApp::saveState(CStringView path, bool notify)
{
if(!system().hasContent())
{
postErrorMessage("System not running");
return false;
}
syncEmulationThread();
log.info("saving state {}", path);
auto suspendCtx = suspendEmulationThread();
try
{
system().saveState(path);
if(notify)
postMessage("State Saved");
return true;
}
catch(std::exception &err)
@ -1063,9 +1062,9 @@ bool EmuApp::saveState(CStringView path)
}
}
bool EmuApp::saveStateWithSlot(int slot)
bool EmuApp::saveStateWithSlot(int slot, bool notify)
{
return saveState(system().statePath(slot));
return saveState(system().statePath(slot), notify);
}
bool EmuApp::loadState(CStringView path)
@ -1076,7 +1075,7 @@ bool EmuApp::loadState(CStringView path)
return false;
}
log.info("loading state {}", path);
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
try
{
system().loadState(*this, path);
@ -1106,7 +1105,6 @@ FS::PathString EmuApp::inContentSearchPath(std::string_view name) const
FS::PathString EmuApp::validSearchPath(const FS::PathString &path) const
{
auto ctx = appContext();
if(path.empty())
return contentSearchPath;
return hasArchiveExtension(path) ? FS::dirnameUri(path) : path;
@ -1116,7 +1114,7 @@ FS::PathString EmuApp::validSearchPath(const FS::PathString &path) const
[[gnu::weak]] void EmuApp::onCustomizeNavView(EmuApp::NavView &) {}
[[gnu::weak]] std::unique_ptr<View> EmuApp::makeCustomView(ViewAttachParams attach, EmuApp::ViewID id)
[[gnu::weak]] std::unique_ptr<View> EmuApp::makeCustomView(ViewAttachParams, EmuApp::ViewID)
{
return nullptr;
}
@ -1145,7 +1143,7 @@ void EmuApp::resetInput()
void EmuApp::setRunSpeed(double speed)
{
assumeExpr(speed > 0.);
syncEmulationThread();
auto suspendCtx = suspendEmulationThread();
system().frameTimeMultiplier = 1. / speed;
audio.setSpeedMultiplier(speed);
configFrameTime();
@ -1273,11 +1271,7 @@ void EmuApp::saveSystemOptions(FileIO &configFile)
system().writeConfig(ConfigType::CORE, configFile);
}
void EmuApp::syncEmulationThread()
{
renderer.mainTask.awaitPending();
emuSystemTask.pause();
}
EmuSystemTask::SuspendContext EmuApp::suspendEmulationThread() { return emuSystemTask.suspend(); }
FrameTimeConfig EmuApp::configFrameTime()
{
@ -1305,7 +1299,7 @@ void EmuApp::runFrames(EmuSystemTaskContext taskCtx, EmuVideo *video, EmuAudio *
void EmuApp::skipFrames(EmuSystemTaskContext taskCtx, int frames, EmuAudio *audio)
{
assert(system().hasContent());
for(auto i : iotaCount(frames))
for([[maybe_unused]] auto i : iotaCount(frames))
{
system().runFrame(taskCtx, nullptr, audio);
}
@ -1327,7 +1321,7 @@ bool EmuApp::skipForwardFrames(EmuSystemTaskContext taskCtx, int frames)
void EmuApp::notifyWindowPresented()
{
emuSystemTask.notifyFramePresented();
framePresentedSem.release();
}
bool EmuApp::writeScreenshot(IG::PixmapView pix, CStringView path)
@ -1427,17 +1421,15 @@ void EmuApp::setEmuViewOnExtraWindow(bool on, IG::Screen &screen)
winConf.setScreen(screen);
winConf.setFormat(windowDrawableConfig.pixelFormat);
auto extraWin = ctx.makeWindow(winConf,
[this](IG::ApplicationContext ctx, IG::Window &win)
[this](IG::ApplicationContext, IG::Window &win)
{
renderer.attachWindow(win, windowDrawableConfig);
auto &mainWinData = windowData(ctx.mainWindow());
auto &extraWinData = win.makeAppData<WindowData>();
extraWinData.hasPopup = false;
extraWinData.focused = true;
auto suspendCtx = emuSystemTask.setWindow(win);
if(system().isActive())
{
emuSystemTask.pause();
win.moveOnFrame(ctx.mainWindow(), system().onFrameUpdate, frameTimeSource);
setIntendedFrameRate(win, configFrameTime());
}
extraWinData.updateWindowViewport(win, makeViewport(win), renderer);
@ -1450,7 +1442,6 @@ void EmuApp::setEmuViewOnExtraWindow(bool on, IG::Screen &screen)
[&](const Input::Event& e) { return viewController().extraWindowInputEvent(e); },
[&](const DrawEvent& e)
{
auto reportTime = scopeGuard([&]{ reportFrameWorkTime(); });
return viewController().drawExtraWindow(win, e.params, renderer.task());
},
[&](const WindowSurfaceChangeEvent& e)
@ -1474,25 +1465,25 @@ void EmuApp::setEmuViewOnExtraWindow(bool on, IG::Screen &screen)
onFocusChange(e.in);
return true;
},
[&](const DismissRequestEvent& e)
[&](const DismissRequestEvent&)
{
win.dismiss();
return true;
},
[&](const DismissEvent& e)
[&](const DismissEvent&)
{
auto suspendCtx = emuSystemTask.setWindow(mainWindow());
system().resetFrameTime();
log.info("setting emu view on main window");
viewController().moveEmuViewToWindow(appContext().mainWindow());
viewController().movePopupToWindow(appContext().mainWindow());
viewController().placeEmuViews();
mainWindow().postDraw();
if(system().isActive())
{
emuSystemTask.pause();
mainWindow().moveOnFrame(win, system().onFrameUpdate, frameTimeSource);
setIntendedFrameRate(mainWindow(), configFrameTime());
}
suspendCtx.resume();
mainWindow().postDraw();
return true;
},
[](auto&){ return false; }
@ -1501,6 +1492,7 @@ void EmuApp::setEmuViewOnExtraWindow(bool on, IG::Screen &screen)
win.show();
viewController().placeEmuViews();
suspendCtx.resume();
mainWindow().postDraw();
});
if(!extraWin)
@ -1537,6 +1529,10 @@ IG::OnFrameDelegate EmuApp::onFrameDelayed(int8_t delay)
{
return [this, delay](IG::FrameParams params)
{
if(params.isFromRenderer() || video.image())
{
emuSystemTask.window().drawNow();
}
if(delay)
{
addOnFrameDelegate(onFrameDelayed(delay - 1));
@ -1545,7 +1541,6 @@ IG::OnFrameDelegate EmuApp::onFrameDelayed(int8_t delay)
{
if(system().isActive())
{
viewController().emuWindow().setDrawEventPriority(1); // block UI from posting draws
addOnFrame();
}
}
@ -1591,11 +1586,6 @@ void EmuApp::applyCPUAffinity(bool active)
return;
auto frameThreadGroup = std::vector{emuSystemTask.threadId(), renderer.task().threadId()};
system().addThreadGroupIds(frameThreadGroup);
for(auto [idx, id] : enumerate(frameThreadGroup))
{
if(!id)
log.warn("invalid thread group id @ index:{}", idx);
}
if(cpuAffinityMode.value() == CPUAffinityMode::Auto && perfHintManager)
{
if(active)

View File

@ -47,7 +47,7 @@ static AudioStats audioStats{};
static IG::Timer audioStatsTimer{"audioStatsTimer"};
#endif
static void startAudioStats(IG::Audio::Format format)
static void startAudioStats([[maybe_unused]] Audio::Format format)
{
#ifdef CONFIG_EMUFRAMEWORK_AUDIO_STATS
audioStats.reset();

View File

@ -58,8 +58,8 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
case fastForward:
{
viewController.inputView.setAltSpeedMode(AltSpeedMode::fast, isPushed);
break;
}
break;
case openContent:
{
if(!isPushed)
@ -88,16 +88,9 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
{
if(!isPushed)
break;
static auto doSaveState = [](EmuApp &app, bool notify)
{
if(app.saveStateWithSlot(app.system().stateSlot()) && notify)
{
app.postMessage("State Saved");
}
};
static auto doSaveState = [](EmuApp &app, bool notify){ app.saveStateWithSlot(app.system().stateSlot(), notify); };
if(app.shouldOverwriteExistingState())
{
app.syncEmulationThread();
doSaveState(app, app.confirmOverwriteState);
}
else
@ -119,7 +112,6 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
{
if(!isPushed)
break;
app.syncEmulationThread();
app.loadStateWithSlot(system.stateSlot());
return true;
}
@ -127,6 +119,7 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
{
if(!isPushed)
break;
auto suspendCtx = app.suspendEmulationThread();
system.decStateSlot();
app.postMessage(1, false, std::format("State Slot: {}", system.stateSlotName()));
return true;
@ -135,6 +128,7 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
{
if(!isPushed)
break;
auto suspendCtx = app.suspendEmulationThread();
system.incStateSlot();
app.postMessage(1, false, std::format("State Slot: {}", system.stateSlotName()));
return true;
@ -151,8 +145,8 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
if(!isPushed)
break;
viewController.inputView.toggleAltSpeedMode(AltSpeedMode::fast);
break;
}
break;
case openMenu:
{
if(!isPushed)
@ -166,61 +160,66 @@ bool InputManager::handleAppActionKeyInput(EmuApp& app, InputAction action, cons
turboModifierActive = isPushed;
if(!isPushed)
turboActions = {};
break;
}
break;
case exitApp:
{
if(!isPushed)
break;
viewController.pushAndShowModal(std::make_unique<YesNoAlertView>(app.attachParams(), "Really Exit?",
YesNoAlertView::Delegates{.onYes = [&app]{ app.appContext().exit(); }}), srcEvent, false);
break;
}
break;
case slowMotion:
{
viewController.inputView.setAltSpeedMode(AltSpeedMode::slow, isPushed);
break;
}
break;
case toggleSlowMotion:
{
if(!isPushed)
break;
viewController.inputView.toggleAltSpeedMode(AltSpeedMode::slow);
break;
}
break;
case rewind:
{
if(!isPushed)
break;
if(app.rewindManager.maxStates)
{
app.rewindManager.rewindState(app);
}
else
{
auto suspendCtx = app.suspendEmulationThread();
app.postMessage(3, false, "Please set rewind states in Options➔System");
break;
}
}
break;
case softReset:
{
if(!isPushed)
break;
app.syncEmulationThread();
auto suspendCtx = app.suspendEmulationThread();
system.reset(app, EmuSystem::ResetMode::SOFT);
break;
}
break;
case hardReset:
{
if(!isPushed)
break;
app.syncEmulationThread();
auto suspendCtx = app.suspendEmulationThread();
system.reset(app, EmuSystem::ResetMode::HARD);
break;
}
break;
case resetMenu:
{
if(!isPushed)
break;
viewController.pushAndShowModal(resetAlertView(app.attachParams(), app), srcEvent, false);
break;
}
break;
}
return false;
}
@ -252,7 +251,7 @@ void InputManager::updateInputDevices(ApplicationContext ctx)
for(auto &devPtr : ctx.inputDevices())
{
log.info("input device:{}, id:{}, map:{}", devPtr->name(), devPtr->enumId(), (int)devPtr->map());
auto &appData = devPtr->makeAppData<InputDeviceData>(*this, *devPtr);
devPtr->makeAppData<InputDeviceData>(*this, *devPtr);
}
vController.setPhysicalControlsPresent(ctx.keyInputIsPresent());
onUpdateDevices.callCopySafe();
@ -404,7 +403,7 @@ bool InputManager::readCustomKeyConfig(MapIO &io)
bool InputManager::readSavedInputDevices(MapIO &io)
{
auto confs = io.get<uint8_t>();
for(auto confIdx : iotaCount(confs))
for([[maybe_unused]] auto confIdx : iotaCount(confs))
{
InputDeviceSavedConfig devConf;
auto enumIdWithFlags = io.get<uint8_t>();
@ -428,7 +427,7 @@ bool InputManager::readSavedInputDevices(MapIO &io)
log.error("unexpected 0 length device name");
return false;
}
auto keyConfMap = Input::validateMap(io.get<uint8_t>());
[[maybe_unused]] auto keyConfMap = Input::validateMap(io.get<uint8_t>());
readSizedData<uint8_t>(io, devConf.keyConfName);
if(!find(savedDevConfigs, [&](const auto &confPtr){ return *confPtr == devConf;}))
{
@ -506,7 +505,7 @@ bool InputManager::readInputDeviceSessionConfigs(ApplicationContext ctx, MapIO &
{
savedSessionDevConfigs.clear();
auto confs = io.get<uint8_t>();
for(auto confIdx : iotaCount(confs))
for([[maybe_unused]] auto confIdx : iotaCount(confs))
{
InputDeviceSavedSessionConfig devConf;
devConf.enumId = io.get<uint8_t>();

View File

@ -36,7 +36,7 @@ namespace EmuEx
constexpr SystemLogger log{"App"};
void EmuApp::initOptions(IG::ApplicationContext ctx)
void EmuApp::initOptions([[maybe_unused]] IG::ApplicationContext ctx)
{
#ifdef CONFIG_OS_IOS
if(ctx.deviceIsIPad())

View File

@ -323,7 +323,7 @@ void EmuSystem::start(EmuApp &app)
SteadyClockTime EmuSystem::benchmark(EmuVideo &video)
{
auto before = SteadyClock::now();
for(auto i : iotaCount(180))
for([[maybe_unused]] auto i : iotaCount(180))
{
runFrame({}, &video, nullptr);
}
@ -366,7 +366,7 @@ int EmuSystem::updateAudioFramesPerVideoFrame()
return wholeFrames;
}
[[gnu::weak]] FS::PathString EmuSystem::willLoadContentFromPath(std::string_view path, std::string_view displayName)
[[gnu::weak]] FS::PathString EmuSystem::willLoadContentFromPath(std::string_view, std::string_view)
{
return {};
}

View File

@ -27,47 +27,51 @@ constexpr SystemLogger log{"EmuSystemTask"};
EmuSystemTask::EmuSystemTask(EmuApp &app):
app{app} {}
using FrameParamsCommand = EmuSystemTask::FrameParamsCommand;
using PauseCommand = EmuSystemTask::PauseCommand;
using ExitCommand = EmuSystemTask::ExitCommand;
void EmuSystemTask::start()
void EmuSystemTask::start(Window& win)
{
if(taskThread.joinable())
return;
win.setDrawEventPriority(Window::drawEventPriorityLocked); // block UI from posting draws
winPtr = &win;
taskThread = makeThreadSync(
[this](auto &sem)
{
threadId_ = thisThreadId();
auto eventLoop = EventLoop::makeForThread();
winPtr->setFrameEventsOnThisThread();
app.addOnFrameDelayed();
bool started = true;
commandPort.attach(eventLoop, [this, &started](auto msgs)
{
std::binary_semaphore *syncSemPtr{};
for(auto msg : msgs)
{
bool threadIsRunning = msg.command.visit(overloaded
{
[&](FrameParamsCommand &cmd)
[&](SetWindowCommand &cmd)
{
frameParams = cmd.params;
return true;
},
[&](FramePresentedCommand &cmd)
{
framePending = false;
return true;
},
[&](PauseCommand &)
{
//log.debug("got pause command");
//log.debug("got set window command");
cmd.winPtr->moveOnFrame(*winPtr, app.system().onFrameUpdate, app.frameTimeSource);
winPtr = cmd.winPtr;
assumeExpr(msg.semPtr);
syncSemPtr = msg.semPtr;
msg.semPtr->release();
suspendSem.acquire();
return true;
},
[&](SuspendCommand &)
{
//log.debug("got suspend command");
isSuspended = true;
assumeExpr(msg.semPtr);
msg.semPtr->release();
suspendSem.acquire();
return true;
},
[&](ExitCommand &)
{
started = false;
app.removeOnFrame();
winPtr->removeFrameEvents();
threadId_ = 0;
EventLoop::forThread().stop();
return false;
},
@ -75,32 +79,6 @@ void EmuSystemTask::start()
if(!threadIsRunning)
return false;
}
if(hasTime(frameParams.timestamp))
{
if(!framePending)
{
auto params = std::exchange(frameParams, {});
bool renderingFrame = app.advanceFrames(params, this);
if(params.isFromRenderer())
{
framePending = false;
if(!renderingFrame)
{
app.emuWindow().postDraw(1);
}
}
}
else
{
log.debug("previous async frame not ready yet");
doIfUsed(app.frameTimeStats, [&](auto &stats) { stats.missedFrameCallbacks++; });
}
}
if(syncSemPtr)
{
framePending = false;
syncSemPtr->release();
}
return true;
});
sem.release();
@ -111,44 +89,50 @@ void EmuSystemTask::start()
});
}
void EmuSystemTask::pause()
EmuSystemTask::SuspendContext EmuSystemTask::setWindow(Window& win)
{
assert(!isSuspended);
if(!taskThread.joinable())
return;
commandPort.send({.command = PauseCommand{}}, MessageReplyMode::wait);
return {};
auto oldWinPtr = winPtr;
commandPort.send({.command = SetWindowCommand{&win}}, MessageReplyMode::wait);
oldWinPtr->setFrameEventsOnThisThread();
oldWinPtr->setDrawEventPriority(); // allow UI to post draws again
app.flushMainThreadMessages();
return {this};
}
EmuSystemTask::SuspendContext EmuSystemTask::suspend()
{
if(!taskThread.joinable() || isSuspended)
return {};
commandPort.send({.command = SuspendCommand{}}, MessageReplyMode::wait);
app.flushMainThreadMessages();
return {this};
}
void EmuSystemTask::resume()
{
if(!taskThread.joinable() || !isSuspended)
return;
suspendSem.release();
}
void EmuSystemTask::stop()
{
if(!taskThread.joinable())
return;
assert(threadId_ != thisThreadId());
commandPort.send({.command = ExitCommand{}});
taskThread.join();
threadId_ = 0;
winPtr->setFrameEventsOnThisThread();
winPtr->setDrawEventPriority(); // allow UI to post draws again
app.flushMainThreadMessages();
}
void EmuSystemTask::updateFrameParams(FrameParams params)
{
if(!taskThread.joinable()) [[unlikely]]
return;
commandPort.send({.command = FrameParamsCommand{params}});
}
void EmuSystemTask::notifyFramePresented()
{
if(!taskThread.joinable()) [[unlikely]]
return;
commandPort.send({.command = FramePresentedCommand{}});
}
void EmuSystemTask::sendVideoFormatChangedReply(EmuVideo &video)
{
app.runOnMainThread([&video](ApplicationContext)
{
video.dispatchFormatChanged();
});
video.dispatchFormatChanged();
}
void EmuSystemTask::sendFrameFinishedReply(EmuVideo &video)
@ -158,7 +142,7 @@ void EmuSystemTask::sendFrameFinishedReply(EmuVideo &video)
void EmuSystemTask::sendScreenshotReply(bool success)
{
app.runOnMainThread([&app = app, success](ApplicationContext ctx)
app.runOnMainThread([&app = app, success](ApplicationContext)
{
app.printScreenshotResult(success);
});

View File

@ -28,7 +28,7 @@ EmuFrameTimeInfo EmuTiming::advanceFrames(FrameParams params)
{
auto frameTimeDiff = params.timestamp - lastFrameTimestamp_;
auto framesDiff = params.elapsedFrames(lastFrameTimestamp_);
auto lastTimestamp = std::exchange(lastFrameTimestamp_, params.timestamp);
std::exchange(lastFrameTimestamp_, params.timestamp);
if(exactFrameDivisor > 0)
{
savedAdvancedFrames += framesDiff;
@ -52,7 +52,7 @@ EmuFrameTimeInfo EmuTiming::advanceFrames(FrameParams params)
}
assumeExpr(timePerVideoFrame.count() > 0);
assumeExpr(startFrameTime.time_since_epoch().count() > 0);
assumeExpr(params.timestamp > startFrameTime);
assumeExpr(params.timestamp >= startFrameTime);
auto timeTotal = params.timestamp - startFrameTime;
auto now = divRoundClosestPositive(timeTotal.count(), timePerVideoFrame.count());
int elapsedFrames = now - lastFrame;

View File

@ -151,7 +151,6 @@ void EmuVideo::finishFrame(EmuSystemTaskContext taskCtx, Gfx::LockedTextureBuffe
{
doScreenshot(taskCtx, texBuff.pixmap());
}
app().record(FrameTimeStatEvent::aboutToSubmitFrame);
vidImg.unlock(texBuff);
postFrameFinished(taskCtx);
}
@ -162,7 +161,6 @@ void EmuVideo::finishFrame(EmuSystemTaskContext taskCtx, IG::PixmapView pix)
{
doScreenshot(taskCtx, pix);
}
app().record(FrameTimeStatEvent::aboutToSubmitFrame);
vidImg.write(pix, {.async = true});
postFrameFinished(taskCtx);
}

View File

@ -46,7 +46,7 @@ struct InputDeviceData
bool keysArePushed(MappedKeys);
};
static InputDeviceData& inputDevData(const Input::Device &d)
inline InputDeviceData& inputDevData(const Input::Device& d)
{
return *d.appData<InputDeviceData>();
}

View File

@ -33,7 +33,7 @@ KeyConfig KeyConfig::readConfig(MapIO &io)
readSizedData<uint8_t>(io, keyConf.name);
auto mappings = io.get<uint8_t>();
keyConf.keyMap.reserve(mappings);
for(auto mappingIdx : iotaCount(mappings))
for([[maybe_unused]] auto mappingIdx : iotaCount(mappings))
{
KeyMapping m;
io.read(m.key.codes.data(), m.key.codes.capacity());
@ -86,7 +86,7 @@ void KeyConfig::set(KeyInfo key, MappedKeys mapKey)
{
if(!mapKey[0])
{
std::ranges::remove_if(keyMap, [&](auto &val){ return val.key == key; });
std::erase_if(keyMap, [&](auto &val){ return val.key == key; });
return;
}
if(auto it = find(key);

View File

@ -29,8 +29,8 @@ RewindManager::RewindManager(EmuApp &app):
saveTimer
{
defaultSaveFreq,
"RewindManager::saveStateTimer",
[this, &app]()
{.debugLabel = "RewindManager::saveStateTimer"},
[this, &app]
{
//log.debug("running rewind save state timer");
saveState(app);

View File

@ -193,7 +193,7 @@ void VideoImageEffect::compileEffect(Gfx::Renderer &r, EffectDesc desc, bool use
updateProgramUniforms(r);
}
void VideoImageEffect::updateProgramUniforms(Gfx::Renderer &r)
void VideoImageEffect::updateProgramUniforms(Gfx::Renderer&)
{
if(srcTexelDeltaU != -1)
prog.uniform(srcTexelDeltaU, 1.0f / (float)inputImgSize.x, 1.0f / (float)inputImgSize.y);

View File

@ -68,7 +68,7 @@ AudioOptionView::AudioOptionView(ViewAttachParams attach, EmuAudio& audio_, bool
MenuId{audio_.maxVolume()},
soundVolumeItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", audio.maxVolume()));
return true;

View File

@ -54,7 +54,7 @@ BundledGamesView::BundledGamesView(ViewAttachParams attach):
}
} {}
[[gnu::weak]] const BundledGameInfo &EmuSystem::bundledGameInfo(int idx) const
[[gnu::weak]] const BundledGameInfo &EmuSystem::bundledGameInfo(int) const
{
static const BundledGameInfo info[]
{

View File

@ -52,8 +52,8 @@ ButtonConfigView::ButtonConfigView(ViewAttachParams attach, InputManagerView &ro
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return resetItemsSize + cat.keys.size(); },
[&](const GetItemMessage &m) -> ItemReply
[&](const ItemsMessage&) -> ItemReply { return resetItemsSize + cat.keys.size(); },
[&](const GetItemMessage& m) -> ItemReply
{
if(m.idx == 0)
return &resetDefaults;

View File

@ -29,8 +29,8 @@ BaseCheatsView::BaseCheatsView(ViewAttachParams attach):
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage &m) -> ItemReply
[&](const ItemsMessage&) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage& m) -> ItemReply
{
if(m.idx == 0)
return &edit;

View File

@ -88,7 +88,6 @@ bool EmuInputView::inputEvent(const Input::Event& e, ViewInputEventParams)
if(vController->keyInput(keyEv))
return true;
auto &emuApp = app();
auto &sys = emuApp.system();
auto &devData = inputDevData(*keyEv.device());
const auto &actionTable = devData.actionTable;
if(!actionTable.size()) [[unlikely]]

View File

@ -33,7 +33,7 @@ EmuView::EmuView(ViewAttachParams attach, EmuVideoLayer *layer, EmuSystem &sys):
void EmuView::prepareDraw()
{
doIfUsed(frameTimeStats, [&](auto &stats){ stats.text.makeGlyphs(); });
doIfUsed(frameTimeStats, [&](auto &stats){ stats.text.makeGlyphs(); stats.text.face()->precacheAlphaNum(renderer()); });
#ifdef CONFIG_EMUFRAMEWORK_AUDIO_STATS
audioStatsText.makeGlyphs(renderer());
#endif
@ -114,33 +114,27 @@ void EmuView::updateFrameTimeStats(FrameTimeStats stats, SteadyClockTimePoint cu
auto deadline = duration_cast<Milliseconds>(screen()->presentationDeadline());
auto timestampDiff = duration_cast<Milliseconds>(currentFrameTimestamp - stats.startOfFrame);
auto callbackOverhead = duration_cast<Milliseconds>(stats.startOfEmulation - stats.startOfFrame);
auto emulationTime = duration_cast<Milliseconds>(stats.aboutToSubmitFrame - stats.startOfEmulation);
auto submitFrameTime = duration_cast<Milliseconds>(stats.aboutToPostDraw - stats.aboutToSubmitFrame);
auto postDrawTime = duration_cast<Milliseconds>(stats.startOfDraw - stats.aboutToPostDraw);
auto drawTime = duration_cast<Milliseconds>(stats.aboutToPresent - stats.startOfDraw);
auto presentTime = duration_cast<Milliseconds>(stats.endOfDraw - stats.aboutToPresent);
auto frameTime = duration_cast<Milliseconds>(stats.endOfDraw - stats.startOfFrame);
auto emulationTime = duration_cast<Milliseconds>(stats.waitForPresent - stats.startOfEmulation);
auto presentTime = duration_cast<Milliseconds>(stats.endOfFrame - stats.waitForPresent);
auto frameTime = duration_cast<Milliseconds>(stats.endOfFrame - stats.startOfFrame);
doIfUsed(frameTimeStats, [&](auto &statsUI)
{
statsUI.text.resetString(std::format("Frame Time Stats\n\n"
"Screen Frame Time: {}ms\n"
"Deadline: {}ms\n"
"Timestamp Diff: {}ms\n"
"Frame Callback: {}ms\n"
"Emulate: {}ms\n"
"Submit Frame: {}ms\n"
"Draw Callback: {}ms\n"
"Draw: {}ms\n"
"Present: {}ms\n"
"Total: {}ms\n"
"Screen Frame Time: {}\n"
"Deadline: {}\n"
"Timestamp Diff: {}\n"
"Frame Callback: {}\n"
"Emulate: {}\n"
"Present: {}\n"
"Total: {}\n"
"Missed Callbacks: {}",
screenFrameTime.count(), deadline.count(), timestampDiff.count(), callbackOverhead.count(), emulationTime.count(), submitFrameTime.count(),
postDrawTime.count(), drawTime.count(), presentTime.count(), frameTime.count(), stats.missedFrameCallbacks));
screenFrameTime, deadline, timestampDiff, callbackOverhead, emulationTime,
presentTime, frameTime, stats.missedFrameCallbacks));
placeFrameTimeStats();
});
}
void EmuView::updateAudioStats(int underruns, int overruns, int callbacks, double avgCallbackFrames, int frames)
void EmuView::updateAudioStats([[maybe_unused]] int underruns, [[maybe_unused]] int overruns, [[maybe_unused]] int callbacks, [[maybe_unused]] double avgCallbackFrames, [[maybe_unused]] int frames)
{
#ifdef CONFIG_EMUFRAMEWORK_AUDIO_STATS
audioStatsText.setString(std::format("Underruns:{}\nOverruns:{}\nCallbacks per second:{}\nFrames per callback:{:g}\nTotal frames:{}",

View File

@ -46,9 +46,7 @@ EmuViewController::EmuViewController(ViewAttachParams viewAttach,
viewStack{viewAttach, app()}
{
inputView.setController(this);
auto &win = viewAttach.window;
auto &face = viewAttach.viewManager.defaultFace;
auto &screen = *viewAttach.window.screen();
{
auto viewNav = std::make_unique<BasicNavView>
(
@ -353,9 +351,14 @@ void EmuViewController::prepareDraw()
viewStack.prepareDraw();
}
static Gfx::DrawAsyncMode drawAsyncMode(bool showingEmulation)
{
return showingEmulation ? Gfx::DrawAsyncMode::FULL : Gfx::DrawAsyncMode::AUTO;
}
bool EmuViewController::drawMainWindow(IG::Window &win, IG::WindowDrawParams params, Gfx::RendererTask &task)
{
return task.draw(win, params, {},
return task.draw(win, params, {.asyncMode = drawAsyncMode(showingEmulation)},
[this, isBlankFrame = std::exchange(drawBlankFrame, {})](IG::Window &win, Gfx::RendererCommands &cmds)
{
auto &winData = windowData(win);
@ -371,9 +374,7 @@ bool EmuViewController::drawMainWindow(IG::Window &win, IG::WindowDrawParams par
emuView.drawframeTimeStatsText(cmds);
if(winData.hasPopup)
popup.draw(cmds);
app().record(FrameTimeStatEvent::aboutToPresent);
cmds.present(presentTime);
app().record(FrameTimeStatEvent::endOfDraw);
app().notifyWindowPresented();
}
else
@ -392,7 +393,7 @@ bool EmuViewController::drawMainWindow(IG::Window &win, IG::WindowDrawParams par
bool EmuViewController::drawExtraWindow(IG::Window &win, IG::WindowDrawParams params, Gfx::RendererTask &task)
{
return task.draw(win, params, {},
return task.draw(win, params, {.asyncMode = drawAsyncMode(showingEmulation)},
[this](IG::Window &win, Gfx::RendererCommands &cmds)
{
auto &winData = windowData(win);

View File

@ -72,7 +72,7 @@ FilePathOptionView::FilePathOptionView(ViewAttachParams attach, bool customMenu)
fPicker->setPath(userSavePath.size() && userSavePath != optionSavePathDefaultToken ? userSavePath
: app().contentSearchPath, e);
fPicker->setOnSelectPath(
[this](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event &e)
[this](FSPicker &picker, CStringView path, [[maybe_unused]] std::string_view displayName, const Input::Event&)
{
if(!hasWriteAccessToDir(path))
{
@ -102,7 +102,7 @@ FilePathOptionView::FilePathOptionView(ViewAttachParams attach, bool customMenu)
view.dismiss();
});
multiChoiceView->appendItem("Legacy Game Data Folder",
[this](View &view, const Input::Event &e)
[this](View&, const Input::Event &e)
{
pushAndShowModal(makeView<YesNoAlertView>(
std::format("Please select the \"Game Data/{}\" folder from an old version of the app to use its existing saves "
@ -114,7 +114,7 @@ FilePathOptionView::FilePathOptionView(ViewAttachParams attach, bool customMenu)
auto fPicker = makeView<FilePicker>(FSPicker::Mode::DIR, EmuSystem::NameFilterFunc{}, e);
fPicker->setPath("");
fPicker->setOnSelectPath(
[this](FSPicker &picker, CStringView path, std::string_view displayName, const Input::Event &e)
[this](FSPicker &picker, CStringView path, [[maybe_unused]] std::string_view displayName, const Input::Event&)
{
auto ctx = appContext();
if(!hasWriteAccessToDir(path))

View File

@ -33,7 +33,7 @@ FilePicker::FilePicker(ViewAttachParams attach,
} {}
FilePicker::FilePicker(ViewAttachParams attach, EmuApp &app,
FSPicker::Mode mode, EmuSystem::NameFilterFunc filter, const Input::Event &e, bool includeArchives):
FSPicker::Mode mode, EmuSystem::NameFilterFunc filter, const Input::Event&, bool includeArchives):
FSPicker
{
attach,

View File

@ -148,7 +148,7 @@ public:
}
}
void onAddedToController(ViewController *, const Input::Event &e) final
void onAddedToController(ViewController*, const Input::Event&) final
{
lastFrameTimestamp = SteadyClock::now();
detectFrameRate =
@ -270,7 +270,7 @@ FrameTimingView::FrameTimingView(ViewAttachParams attach):
app().outputTimingManager.frameTimeOptionAsMenuId(VideoSystem::NATIVE_NTSC),
frameRateItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(makeFrameRateStr(VideoSystem::NATIVE_NTSC, app().outputTimingManager));
return true;
@ -288,7 +288,7 @@ FrameTimingView::FrameTimingView(ViewAttachParams attach):
app().outputTimingManager.frameTimeOptionAsMenuId(VideoSystem::PAL),
frameRateItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(makeFrameRateStr(VideoSystem::PAL, app().outputTimingManager));
return true;
@ -320,7 +320,7 @@ FrameTimingView::FrameTimingView(ViewAttachParams attach):
frameClockItems,
MultiChoiceMenuItem::Config
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(wise_enum::to_string(app().effectiveFrameTimeSource()));
return true;
@ -345,7 +345,7 @@ FrameTimingView::FrameTimingView(ViewAttachParams attach):
presentModeItems,
MultiChoiceMenuItem::Config
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(renderer().evalPresentMode(app().emuWindow(), app().presentMode) == Gfx::PresentMode::FIFO ? "Queued" : "Immediate");
return true;
@ -387,7 +387,7 @@ FrameTimingView::FrameTimingView(ViewAttachParams attach):
presentationTimeItems,
MultiChoiceMenuItem::Config
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
if(app().presentationTimeMode == PresentationTimeMode::off)
return false;

View File

@ -75,7 +75,7 @@ GUIOptionView::GUIOptionView(ViewAttachParams attach, bool customMenu):
MenuId{app().fontSize},
fontSizeItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}", app().fontSize / 1000.));
return true;

View File

@ -161,7 +161,7 @@ InputManagerView::InputManagerView(ViewAttachParams attach,
rescanOSDevices
{
"Re-scan OS Input Devices", attach,
[this](const Input::Event &e)
[this]
{
appContext().enumInputDevices();
int devices = 0;
@ -552,7 +552,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"Handle Unbound Keys", attach,
inputDevData(dev).devConf.shouldHandleUnboundKeys,
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.shouldHandleUnboundKeys = item.flipBoolValue(*this);
devConf.save(inputManager);
@ -562,7 +562,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"Stick 1 as D-Pad", attach,
inputDevData(dev).devConf.joystickAxesAsKeys(Input::AxisSetId::stick1),
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.setJoystickAxesAsKeys(Input::AxisSetId::stick1, item.flipBoolValue(*this));
devConf.save(inputManager);
@ -572,7 +572,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"Stick 2 as D-Pad", attach,
inputDevData(dev).devConf.joystickAxesAsKeys(Input::AxisSetId::stick2),
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.setJoystickAxesAsKeys(Input::AxisSetId::stick2, item.flipBoolValue(*this));
devConf.save(inputManager);
@ -582,7 +582,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"POV Hat as D-Pad", attach,
inputDevData(dev).devConf.joystickAxesAsKeys(Input::AxisSetId::hat),
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.setJoystickAxesAsKeys(Input::AxisSetId::hat, item.flipBoolValue(*this));
devConf.save(inputManager);
@ -592,7 +592,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"L/R Triggers as L2/R2", attach,
inputDevData(dev).devConf.joystickAxesAsKeys(Input::AxisSetId::triggers),
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.setJoystickAxesAsKeys(Input::AxisSetId::triggers, item.flipBoolValue(*this));
devConf.save(inputManager);
@ -602,7 +602,7 @@ InputManagerDeviceView::InputManagerDeviceView(UTF16String name, ViewAttachParam
{
"Brake/Gas as L2/R2", attach,
inputDevData(dev).devConf.joystickAxesAsKeys(Input::AxisSetId::pedals),
[this](BoolMenuItem &item, const Input::Event &e)
[this](BoolMenuItem& item)
{
devConf.setJoystickAxesAsKeys(Input::AxisSetId::pedals, item.flipBoolValue(*this));
devConf.save(inputManager);

View File

@ -49,7 +49,7 @@ protected:
static void onScanStatus(EmuApp &app, BluetoothScanState status, int arg);
template <class ViewT>
static void handledFailedBTAdapterInit(ViewT &view, ViewAttachParams attach, const Input::Event &e)
static void handledFailedBTAdapterInit(ViewT& view, [[maybe_unused]] ViewAttachParams attach, [[maybe_unused]] const Input::Event& e)
{
view.app().postErrorMessage("Unable to initialize Bluetooth adapter");
#ifdef CONFIG_BLUETOOTH_BTSTACK
@ -186,7 +186,7 @@ MainMenuView::MainMenuView(ViewAttachParams attach, bool customMenu):
{
app().postMessage(4, "Prepare to push the PS button");
auto startedScan = Bluetooth::listenForDevices(appContext(), app().bluetoothAdapter,
[this](BluetoothAdapter &bta, BluetoothScanState status, int arg)
[this](BluetoothAdapter&, BluetoothScanState status, int arg)
{
switch(status)
{
@ -348,8 +348,8 @@ OptionCategoryView::OptionCategoryView(ViewAttachParams attach):
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return EmuApp::hasGooglePlayStoreFeatures() ? std::size(subConfig) : std::size(subConfig)-1; },
[&](const GetItemMessage &m) -> ItemReply { return &subConfig[m.idx]; },
[&](const ItemsMessage&) -> ItemReply { return EmuApp::hasGooglePlayStoreFeatures() ? std::size(subConfig) : std::size(subConfig)-1; },
[&](const GetItemMessage& m) -> ItemReply { return &subConfig[m.idx]; },
});
}
},

View File

@ -22,7 +22,7 @@
namespace EmuEx
{
constexpr SystemLogger log{"PlaceVControlsView"};
[[maybe_unused]] constexpr SystemLogger log{"PlaceVControlsView"};
constexpr std::array snapPxSizes{0, 2, 4, 8, 16, 32, 64};
PlaceVControlsView::PlaceVControlsView(ViewAttachParams attach, VController &vController_):

View File

@ -30,8 +30,8 @@ RecentContentView::RecentContentView(ViewAttachParams attach, RecentContent &rec
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return 1 + recentItems.size(); },
[&](const GetItemMessage &m) -> ItemReply { return m.idx < recentItems.size() ? &recentItems[m.idx] : &clear; },
[&](const ItemsMessage&) -> ItemReply { return 1 + recentItems.size(); },
[&](const GetItemMessage& m) -> ItemReply { return m.idx < recentItems.size() ? &recentItems[m.idx] : &clear; },
});
}
},
@ -56,7 +56,7 @@ RecentContentView::RecentContentView(ViewAttachParams attach, RecentContent &rec
recentItems.reserve(recentContent_.size());
for(auto &entry : recentContent_)
{
auto &recentItem = recentItems.emplace_back(entry.name, attach,
recentItems.emplace_back(entry.name, attach,
[this, &entry](const Input::Event &e)
{
app().createSystemWithMedia({}, entry.path, appContext().fileUriDisplayName(entry.path), e, {}, attachParams(),

View File

@ -30,7 +30,7 @@ public:
TextMenuItem
{
"Soft Reset", attach,
[this, &app]()
[&app]()
{
app.system().reset(app, EmuSystem::ResetMode::SOFT);
app.showEmulation();
@ -39,7 +39,7 @@ public:
TextMenuItem
{
"Hard Reset", attach,
[this, &app]()
[&app]()
{
app.system().reset(app, EmuSystem::ResetMode::HARD);
app.showEmulation();

View File

@ -98,7 +98,7 @@ void StateSlotView::refreshSlot(int slot)
return std::format("{}", sys.stateSlotName(slot));
};
auto &s = stateSlot[slot];
s = {str(), attachParams(), [this, slot](View &view)
s = {str(), attachParams(), [this, slot](View&)
{
auto &sys = system();
stateSlot[sys.stateSlot()].setHighlighted(false);
@ -125,7 +125,7 @@ void StateSlotView::refreshSlots()
void StateSlotView::doSaveState()
{
auto slot = system().stateSlot();
if(app().saveStateWithSlot(slot))
if(app().saveStateWithSlot(slot, false))
app().showEmulation();
refreshSlot(slot);
place();

View File

@ -50,7 +50,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
},
autosaveTimer
{
"Autosave Timer", attach,
"Timer", attach,
MenuId{app().autosaveManager.saveTimer.frequency.count()},
autosaveTimerItem,
{
@ -73,7 +73,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
},
autosaveLaunch
{
"Autosave Launch Mode", attach,
"Launch Mode", attach,
MenuId{app().autosaveManager.autosaveLaunchMode},
autosaveLaunchItem,
{
@ -82,7 +82,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
},
autosaveContent
{
"Autosave Content", attach,
"Content", attach,
app().autosaveManager.saveOnlyBackupMemory,
"State & Backup RAM", "Only Backup RAM",
[this](BoolMenuItem &item)
@ -128,7 +128,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
MenuId{app().altSpeed(AltSpeedMode::fast)},
fastModeSpeedItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}x", app().altSpeedAsDouble(AltSpeedMode::fast)));
return true;
@ -169,7 +169,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
MenuId{app().altSpeed(AltSpeedMode::slow)},
slowModeSpeedItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}x", app().altSpeedAsDouble(AltSpeedMode::slow)));
return true;
@ -199,11 +199,11 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
},
rewindStates
{
"Rewind States", attach,
"States", attach,
MenuId{app().rewindManager.maxStates},
rewindStatesItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}", app().rewindManager.maxStates));
return true;
@ -213,7 +213,7 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
},
rewindTimeInterval
{
"Rewind State Interval (Seconds)", std::to_string(app().rewindManager.saveTimer.frequency.count()), attach,
"State Interval (Seconds)", std::to_string(app().rewindManager.saveTimer.frequency.count()), attach,
[this](const Input::Event &e)
{
pushAndShowNewCollectValueRangeInputView<int, 1, 60>(attachParams(), e,
@ -252,7 +252,10 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
{
pushAndShow(makeView<CPUAffinityView>(appContext().cpuCount()), e);
}
}
},
autosaveHeading{"Autosave Options", attach},
rewindHeading{"Rewind Options", attach},
otherHeading{"Other Options", attach}
{
if(!customMenu)
{
@ -262,14 +265,17 @@ SystemOptionView::SystemOptionView(ViewAttachParams attach, bool customMenu):
void SystemOptionView::loadStockItems()
{
item.emplace_back(&autosaveHeading);
item.emplace_back(&autosaveLaunch);
item.emplace_back(&autosaveTimer);
item.emplace_back(&autosaveContent);
item.emplace_back(&rewindHeading);
item.emplace_back(&rewindStates);
item.emplace_back(&rewindTimeInterval);
item.emplace_back(&otherHeading);
item.emplace_back(&confirmOverwriteState);
item.emplace_back(&fastModeSpeed);
item.emplace_back(&slowModeSpeed);
item.emplace_back(&rewindStates);
item.emplace_back(&rewindTimeInterval);
if(used(performanceMode) && appContext().hasSustainedPerformanceMode())
item.emplace_back(&performanceMode);
if(used(noopThread))

View File

@ -33,8 +33,6 @@
namespace EmuEx
{
constexpr bool CAN_TURN_OFF_MENU_BTN = !Config::envIsIOS;
constexpr const char *ctrlStateStr[]
{
"Off", "On", "Hidden"
@ -50,7 +48,7 @@ constexpr int touchCtrlExtraBtnSizeMenuVal[4]
0, 10, 20, 30
};
static void addCategories(EmuApp &app, VControllerElement &elem, auto &&addCategory)
static void addCategories(EmuApp&, VControllerElement &elem, auto &&addCategory)
{
if(elem.uiButtonGroup())
{
@ -100,7 +98,7 @@ public:
MenuId{elem.dPad()->deadzone()},
deadzoneItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}mm", elem.dPad()->deadzone() / 100.));
return true;
@ -139,7 +137,7 @@ public:
MenuId{elem.dPad()->diagonalSensitivity() * 1000.f},
diagonalSensitivityItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}%", 100.f - elem.dPad()->diagonalSensitivity() * 100.f));
return true;
@ -451,7 +449,7 @@ public:
MenuId{elem.buttonGroup() ? elem.buttonGroup()->spacing() : 0},
spaceItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}mm", elem.buttonGroup()->spacing()));
return true;
@ -590,7 +588,7 @@ public:
for(auto &k : cat.keys)
{
multiChoiceView->appendItem(app.inputManager.toString(k),
[this, k](View &parentView, const Input::Event &e)
[this, k](View &parentView, const Input::Event&)
{
elem.add(k);
vCtrl.update(elem);
@ -709,17 +707,17 @@ public:
{
buttons.emplace_back(
c.name, attach,
[this, &c](const Input::Event &e){ add(c); });
[this, &c]{ add(c); });
}
buttons.emplace_back(
rightUIComponents.name, attach,
[this](const Input::Event &e){ add(rightUIComponents); });
[this]{ add(rightUIComponents); });
buttons.emplace_back(
leftUIComponents.name, attach,
[this](const Input::Event &e){ add(leftUIComponents); });
[this]{ add(leftUIComponents); });
buttons.emplace_back(
rewindUIComponents.name, attach,
[this](const Input::Event &e){ add(rewindUIComponents); });
[this]{ add(rewindUIComponents); });
}
private:
@ -837,7 +835,7 @@ TouchConfigView::TouchConfigView(ViewAttachParams attach, VController &vCtrl):
MenuId{vController.buttonSize()},
sizeItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{:g}mm", vController.buttonSize() / 100.));
return true;

View File

@ -28,7 +28,7 @@
namespace EmuEx
{
constexpr SystemLogger log{"VideoOptionView"};
[[maybe_unused]] constexpr SystemLogger log{"VideoOptionView"};
static const char *autoWindowPixelFormatStr(IG::ApplicationContext ctx)
{
@ -171,7 +171,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{videoLayer_.scale},
contentScaleItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
if(videoLayer.scale <= 200)
{
@ -209,7 +209,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{app().menuScale},
menuScaleItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", app().menuScale.value()));
return true;
@ -329,7 +329,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{videoLayer_.overlayIntensity() * 100.f},
overlayEffectLevelItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", int(videoLayer.overlayIntensity() * 100.f)));
return true;
@ -499,7 +499,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{videoLayer_.channelBrightnessAsInt(ImageChannel::Red)},
redItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", videoLayer.channelBrightnessAsInt(ImageChannel::Red)));
return true;
@ -512,7 +512,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{videoLayer_.channelBrightnessAsInt(ImageChannel::Green)},
greenItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", videoLayer.channelBrightnessAsInt(ImageChannel::Green)));
return true;
@ -525,7 +525,7 @@ VideoOptionView::VideoOptionView(ViewAttachParams attach, EmuVideoLayer &videoLa
MenuId{videoLayer_.channelBrightnessAsInt(ImageChannel::Blue)},
blueItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", videoLayer.channelBrightnessAsInt(ImageChannel::Blue)));
return true;

View File

@ -47,7 +47,7 @@ static bool hasKnownExtension(std::string_view name, const std::vector<FileExten
}
MDFNFILE::MDFNFILE(VirtualFS* vfs, const std::string& path, const std::vector<FileExtensionSpecStruct>& known_ext,
const char* purpose, int* monocomp_double_ext)
[[maybe_unused]] const char* purpose, [[maybe_unused]] int* monocomp_double_ext)
{
if(IG::FS::hasArchiveExtension(path))
{
@ -83,10 +83,10 @@ MDFNFILE::MDFNFILE(VirtualFS* vfs, const std::string& path, const std::vector<Fi
}
}
MDFNFILE::MDFNFILE(VirtualFS* vfs, std::unique_ptr<Stream> str):
MDFNFILE::MDFNFILE(VirtualFS*, std::unique_ptr<Stream> str):
str{std::move(str)} {}
extern int openFdHelper(const char *file, int oflag, mode_t mode)
extern int openFdHelper(const char *file, int oflag, mode_t)
{
auto openFlags = (oflag & O_CREAT) ? IG::OpenFlags::newFile() : IG::OpenFlags{};
return EmuEx::gAppContext().openFileUriFd(file, openFlags | IG::OpenFlags{.test = true}).release();

View File

@ -92,7 +92,7 @@ inline FS::FileString saveExtMDFN(std::string_view ext, bool skipMD5)
return str;
}
inline std::string savePathMDFN(const EmuApp &app, int id1, const char *cd1, bool skipMD5)
inline std::string savePathMDFN(const EmuApp &app, [[maybe_unused]] int id1, const char *cd1, bool skipMD5)
{
assert(cd1);
IG::FileString ext{'.'};
@ -174,7 +174,7 @@ inline size_t stateSizeMDFN()
return s.size();
}
inline void readStateMDFN(EmuApp &app, std::span<uint8_t> buff)
inline void readStateMDFN(std::span<uint8_t> buff)
{
using namespace Mednafen;
if(hasGzipHeader(buff))

View File

@ -54,7 +54,7 @@ std::pair<IG::OpenFlags, uint8_t> modeToAttribs(uint32 mode)
}
}
FileStream::FileStream(const std::string& path, const uint32 mode, const int do_lock, const uint32 buffer_size)
FileStream::FileStream(const std::string& path, const uint32 mode, const int do_lock, [[maybe_unused]] const uint32 buffer_size)
try:
io{EmuEx::gAppContext().openFileUri(path, modeToAttribs(mode).first)},
attribs{modeToAttribs(mode).second}
@ -182,12 +182,12 @@ void MemoryStream::setSize(size_t size)
data_buffer_size = size;
}
uint64 Stream::readAtPos(void *data, uint64 count, uint64 pos)
uint64 Stream::readAtPos(void*, [[maybe_unused]] uint64 count, [[maybe_unused]] uint64 pos)
{
bug_unreachable("Stream::readAtPos not implemented");
return 0;
}
void Stream::advise(off_t offset, size_t bytes, IG::IOAdvice advice) {}
void Stream::advise(off_t, size_t, IG::IOAdvice) {}
}

View File

@ -61,7 +61,7 @@ void VirtualFS::get_file_path_components(const std::string &file_path, std::stri
*file_ext_out = fileExt;
}
void VirtualFS::check_firop_safe(const std::string& path) {}
void VirtualFS::check_firop_safe(const std::string&) {}
bool VirtualFS::is_path_separator(const char c)
{
@ -73,7 +73,7 @@ bool VirtualFS::is_absolute_path(const std::string& path)
return true;
}
std::string VirtualFS::eval_fip(const std::string& dir_path, const std::string& rel_path, bool skip_safety_check)
std::string VirtualFS::eval_fip(const std::string& dir_path, const std::string& rel_path, [[maybe_unused]] bool skip_safety_check)
{
if(is_absolute_path(rel_path))
return rel_path;
@ -94,9 +94,9 @@ std::string VirtualFS::get_human_mode(uint32 mode)
}
}
void VirtualFS::create_missing_dirs(const std::string& file_path) {}
void VirtualFS::create_missing_dirs(const std::string&) {}
bool VirtualFS::is_driverel_path(const std::string& path) { return false; }
bool VirtualFS::is_driverel_path(const std::string&) { return false; }
}

View File

@ -177,7 +177,6 @@ void VController::place()
{
if(!hasWindow())
return;
auto &winData = windowData();
auto &win = window();
applyButtonSize();
auto bounds = layoutBounds();
@ -220,7 +219,7 @@ std::array<KeyInfo, 2> VController::findGamepadElements(WPt pos)
return {};
return grp.findButtonIndices(pos);
},
[](auto &e) -> std::array<KeyInfo, 2> { return {}; }
[](auto&) -> std::array<KeyInfo, 2> { return {}; }
});
if(indices != std::array<KeyInfo, 2>{})
return indices;
@ -251,7 +250,7 @@ KeyInfo VController::keyboardKeyFromPointer(const Input::MotionEvent &e)
if(!e.pushed())
return {};
log.info("switch kb mode");
kb.cycleMode(system(), renderer());
kb.cycleMode(system());
resetInput();
}
else
@ -358,7 +357,7 @@ bool VController::keyInput(const Input::KeyEvent &e)
{
if(!isInKeyboardMode())
return false;
return kb.keyInput(*this, renderer(), e);
return kb.keyInput(*this, e);
}
void VController::draw(Gfx::RendererCommands &__restrict__ cmds, bool showHidden)
@ -438,7 +437,7 @@ void VController::setDisabledInputKeys(std::span<const KeyCode> disabledKeys_)
e.visit(overloaded
{
[&](VControllerButtonGroup &grp) { updateEnabledButtons(grp); },
[](auto &e){}
[](auto&){}
});
}
place();
@ -669,11 +668,11 @@ bool VController::readConfig(EmuApp &app, MapIO &io, unsigned key)
case CFGKEY_VCONTROLLER_DEVICE_BUTTONS_V2:
{
gpElements.clear();
auto emuDeviceId = io.get<uint8_t>(); // reserved for future use
auto configId = io.get<uint8_t>(); // reserved for future use
[[maybe_unused]] auto emuDeviceId = io.get<uint8_t>(); // reserved for future use
[[maybe_unused]] auto configId = io.get<uint8_t>(); // reserved for future use
auto elements = io.get<uint8_t>();
log.info("read emu device button data ({} bytes) with {} element(s)", io.size(), elements);
for(auto i : iotaCount(elements))
for([[maybe_unused]] auto i : iotaCount(elements))
{
if(!readVControllerElement(app.inputManager, io, gpElements, false))
return false;
@ -683,10 +682,10 @@ bool VController::readConfig(EmuApp &app, MapIO &io, unsigned key)
case CFGKEY_VCONTROLLER_UI_BUTTONS_V2:
{
uiElements.clear();
auto configId = io.get<uint8_t>(); // reserved for future use
[[maybe_unused]] auto configId = io.get<uint8_t>(); // reserved for future use
auto elements = io.get<uint8_t>();
log.info("read UI button data ({} bytes) with {} element(s)", io.size(), elements);
for(auto i : iotaCount(elements))
for([[maybe_unused]] auto i : iotaCount(elements))
{
if(!readVControllerElement(app.inputManager, io, uiElements, true))
return false;
@ -1091,7 +1090,7 @@ void VController::updateSystemKeys(KeyInfo key, bool isPushed)
if(didUpdate)
dpad.setAlpha(alphaF);
},
[](auto &e){}
[](auto&){}
});
}
}
@ -1113,7 +1112,7 @@ void VController::resetHighlightedKeys()
}
}
},
[](auto &e){}
[](auto&){}
});
}
}

View File

@ -335,9 +335,9 @@ void BaseVControllerButtonGroup<Group>::updateSprites()
if constexpr(requires {g.boundQuads;})
{
g.boundQuads.reset({.size = g.buttons.size()});
boundQuadsMap = g.boundQuads.map();
boundQuadsMap = g.boundQuads.map(Gfx::BufferMapMode::indirect);
}
auto quadsMap = g.quads.map();
auto quadsMap = g.quads.map(Gfx::BufferMapMode::indirect);
g.enabledBtns = 0;
for(auto &b : g.buttons)
{

View File

@ -216,7 +216,7 @@ void VControllerDPad::updateSprite()
colors[2] = colors[2].multiplyRGB(2.f);
for(auto &&[i, vtx] : enumerate(spr)) { vtx.color = colors[i]; }
for(auto &&[i, vtx] : enumerate(mapSpr)) { vtx.color = colors[i]; }
auto map = spriteQuads.map();
auto map = spriteQuads.map(Gfx::BufferMapMode::indirect);
spr.write(map, 0);
if(config.visualizeBounds)
mapSpr.write(map, 1);

View File

@ -111,7 +111,7 @@ KeyInfo VControllerKeyboard::translateInput(int idx) const
return table[0][idx];
}
bool VControllerKeyboard::keyInput(VController &v, Gfx::Renderer &r, const Input::KeyEvent &e)
bool VControllerKeyboard::keyInput(VController& v, const Input::KeyEvent& e)
{
if(selected.x == -1)
{
@ -140,7 +140,7 @@ bool VControllerKeyboard::keyInput(VController &v, Gfx::Renderer &r, const Input
if(!e.pushed() || e.repeated())
return false;
log.info("switch kb mode");
cycleMode(v.system(), r);
cycleMode(v.system());
v.resetInput();
}
else if(e.pushed())
@ -223,14 +223,14 @@ void VControllerKeyboard::unselectKey()
IG::WindowRect VControllerKeyboard::extendKeySelection(IG::WindowRect selected)
{
auto key = currentKey(selected.x, selected.y);
for(auto i : iotaCount(selected.x))
for([[maybe_unused]] auto i : iotaCount(selected.x))
{
if(table[selected.y][selected.x - 1] == key)
selected.x--;
else
break;
}
for(auto i : iotaCount((VKEY_COLS - 1) - selected.x2))
for([[maybe_unused]] auto i : iotaCount((VKEY_COLS - 1) - selected.x2))
{
if(table[selected.y][selected.x2 + 1] == key)
selected.x2++;
@ -251,16 +251,16 @@ KeyInfo VControllerKeyboard::currentKey() const
return currentKey(selected.x, selected.y);
}
void VControllerKeyboard::setMode(EmuSystem &sys, Gfx::Renderer &r, VControllerKbMode mode)
void VControllerKeyboard::setMode(EmuSystem& sys, VControllerKbMode mode)
{
mode_ = mode;
updateImg();
updateKeyboardMapping(sys);
}
void VControllerKeyboard::cycleMode(EmuSystem &sys, Gfx::Renderer &r)
void VControllerKeyboard::cycleMode(EmuSystem& sys)
{
setMode(sys, r,
setMode(sys,
mode() == VControllerKbMode::LAYOUT_1 ? VControllerKbMode::LAYOUT_2
: VControllerKbMode::LAYOUT_1);
}
@ -271,7 +271,7 @@ void VControllerKeyboard::applyMap(KbMap map)
// 1st row
auto *__restrict tablePtr = &table[0][0];
auto *__restrict mapPtr = &map[0];
for(auto i : iotaCount(10))
for([[maybe_unused]] auto i : iotaCount(10))
{
tablePtr[0] = *mapPtr;
tablePtr[1] = *mapPtr;
@ -283,7 +283,7 @@ void VControllerKeyboard::applyMap(KbMap map)
if(mode_ == VControllerKbMode::LAYOUT_1)
{
tablePtr = &table[1][1];
for(auto i : iotaCount(9))
for([[maybe_unused]] auto i : iotaCount(9))
{
tablePtr[0] = *mapPtr;
tablePtr[1] = *mapPtr;
@ -294,7 +294,7 @@ void VControllerKeyboard::applyMap(KbMap map)
else
{
tablePtr = &table[1][0];
for(auto i : iotaCount(10))
for([[maybe_unused]] auto i : iotaCount(10))
{
tablePtr[0] = *mapPtr;
tablePtr[1] = *mapPtr;
@ -307,7 +307,7 @@ void VControllerKeyboard::applyMap(KbMap map)
table[2][0] = table[2][1] = table[2][2] = *mapPtr;
mapPtr++;
tablePtr = &table[2][3];
for(auto i : iotaCount(7))
for([[maybe_unused]] auto i : iotaCount(7))
{
tablePtr[0] = *mapPtr;
tablePtr[1] = *mapPtr;
@ -320,7 +320,7 @@ void VControllerKeyboard::applyMap(KbMap map)
table[3][3] = table[3][4] = table[3][5] = VController::CHANGE_KEYBOARD_MODE;
tablePtr = &table[3][6];
mapPtr = &map[33];
for(auto i : iotaCount(8))
for([[maybe_unused]] auto i : iotaCount(8))
{
*tablePtr++ = *mapPtr;
}

View File

@ -11,6 +11,8 @@ CPPFLAGS += -DHAVE_ZLIB_H \
-DNO_DEBUGGER \
-I$(projectPath)/src
CFLAGS_WARN += -Wno-unused-parameter -Wno-unused-function -Wno-unused-but-set-variable
vbamSrc := gba/gbaCpuThumb.cpp \
gba/internal/gbaBios.cpp \
gba/gbaCheats.cpp \

View File

@ -2666,7 +2666,6 @@ void CPUUpdateRegister(ARM7TDMI &cpu, uint32_t address, uint16_t value)
auto &busPrefetchCount = cpu.busPrefetchCount;
auto &busPrefetch = cpu.busPrefetch;
auto &busPrefetchEnable = cpu.busPrefetchEnable;
auto &g_ioMem = cpu.gba->mem.ioMem;
auto &gba = *cpu.gba;
switch (address) {
@ -3227,8 +3226,6 @@ void CPUUpdateRegister(ARM7TDMI &cpu, uint32_t address, uint16_t value)
void applyTimer(GBASys &gba, ARM7TDMI &cpu)
{
auto &ioMem = gba.mem.ioMem;
if (timerOnOffDelay & 1) {
timer0ClockReload = TIMER_TICKS[timer0Value & 3];
if (!timer0On && (timer0Value & 0x80)) {

View File

@ -1179,7 +1179,6 @@ static inline void gfxDrawSprites(GBALCD &lcd, uint32_t* lineOBJ, const uint16_t
static inline void gfxDrawOBJWin(GBALCD &lcd, uint32_t* lineOBJWin, const uint16_t VCOUNT, const uint16_t DISPCNT)
{
uint8_t (&g_paletteRAM)[0x400] = lcd.paletteRAM;
uint8_t (&g_vram)[0x20000] = lcd.vram;
uint8_t (&g_oam)[0x400] = lcd.oam;
const auto &coreOptions = lcd;

View File

@ -481,7 +481,6 @@ static inline uint8_t CPUReadByte(ARM7TDMI &cpu, uint32_t address)
static inline void CPUWriteMemory(ARM7TDMI &cpu, uint32_t address, uint32_t value)
{
auto &g_ioMem = cpu.gba->mem.ioMem.b;
#ifdef GBA_LOGGING
if (address & 3) {
if (systemVerbose & VERBOSE_UNALIGNED_MEMORY) {

View File

@ -77,7 +77,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
MenuId{system().optionRtcEmulation.value()},
rtcItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == 0)
{
@ -242,13 +242,13 @@ class CustomAudioOptionView : public AudioOptionView, public MainAppHelper
TextMenuItem
{
"Default", attachParams(),
[this, gbVol]() { soundSetVolume(gGba, 1.f, gbVol); },
[gbVol]() { soundSetVolume(gGba, 1.f, gbVol); },
{.id = 100}
},
TextMenuItem
{
"Off", attachParams(),
[this, gbVol]() { soundSetVolume(gGba, 0, gbVol); },
[gbVol]() { soundSetVolume(gGba, 0, gbVol); },
{.id = 0}
},
TextMenuItem
@ -285,7 +285,7 @@ class CustomAudioOptionView : public AudioOptionView, public MainAppHelper
MenuId{soundVolumeAsInt(gGba, gbVol)},
volumeLevelItem[gbVol ? 1 : 0],
{
.onSetDisplayString = [this, gbVol](auto idx, Gfx::Text &t)
.onSetDisplayString = [gbVol](auto idx, Gfx::Text& t)
{
t.resetString(std::format("{}%", soundVolumeAsInt(gGba, gbVol)));
return true;
@ -328,7 +328,7 @@ class CustomAudioOptionView : public AudioOptionView, public MainAppHelper
TextMenuItem
{
"Default", attachParams(),
[this]() { soundSetFiltering(gGba, .5f); },
[]() { soundSetFiltering(gGba, .5f); },
{.id = 50}
},
TextMenuItem
@ -355,7 +355,7 @@ class CustomAudioOptionView : public AudioOptionView, public MainAppHelper
MenuId{soundFilteringAsInt(gGba)},
filteringLevelItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", soundFilteringAsInt(gGba)));
return true;

View File

@ -678,7 +678,7 @@ static inline uint32_t CPUReadHalfWordQuick(ARM7TDMI &cpu, uint32_t addr)
static inline uint32_t CPUReadMemoryQuick(ARM7TDMI &cpu, uint32_t addr)
{ return READ32LE(((uint32_t*)&cpu.map[addr>>24].address[addr & cpu.map[addr>>24].mask])); }
static void blankLine(MixColorType *lineMix, GBALCD &lcd, const GBAMem::IoMem &ioMem)
inline void blankLine(MixColorType *lineMix, GBALCD &lcd, const GBAMem::IoMem &ioMem)
{
for (int x = 0; x < 240; x++)
lineMix[x] = 0x7fff;

View File

@ -122,7 +122,7 @@ void readCheatFile(EmuSystem &sys_)
return;
}
auto size = file.get<uint16_t>();
for(auto i : iotaCount(size))
for([[maybe_unused]] auto i : iotaCount(size))
{
if(cheatList.isFull())
{
@ -162,7 +162,7 @@ EmuEditCheatView::EmuEditCheatView(ViewAttachParams attach, GbcCheat &cheat_, Re
"Code",
cheat_.code,
attach,
[this](DualTextMenuItem &item, View &, Input::Event e)
[this](Input::Event e)
{
pushAndShowNewCollectValueInputView<const char*>(attachParams(), e,
"Input xxxxxxxx (GS) or xxx-xxx-xxx (GG) code", cheat->code,
@ -206,8 +206,8 @@ EmuEditCheatListView::EmuEditCheatListView(ViewAttachParams attach):
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage &m) -> ItemReply
[&](const ItemsMessage&) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage& m) -> ItemReply
{
switch(m.idx)
{
@ -221,7 +221,7 @@ EmuEditCheatListView::EmuEditCheatListView(ViewAttachParams attach):
addGGGS
{
"Add Game Genie / GameShark Code", attach,
[this](TextMenuItem &item, View &, Input::Event e)
[this](const Input::Event& e)
{
pushAndShowNewCollectTextInputView(attachParams(), e,
"Input xxxxxxxx (GS) or xxx-xxx-xxx (GG) code", "",
@ -310,7 +310,7 @@ void EmuCheatsView::loadCheatItems()
{
auto &thisCheat = *it;
cheat.emplace_back(thisCheat.name, attachParams(), thisCheat.isOn(),
[this, cIdx](BoolMenuItem &item, View &, Input::Event e)
[this, cIdx](BoolMenuItem &item)
{
item.flipBoolValue(*this);
auto &c = cheatList[cIdx];

View File

@ -108,7 +108,7 @@ class CustomVideoOptionView : public VideoOptionView, public MainAppHelper
{
"Saturated GBC Colors", attachParams(),
(bool)system().optionFullGbcSaturation,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().optionFullGbcSaturation = item.flipBoolValue(*this);
if(system().hasContent())
@ -134,7 +134,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
{
"Use Built-in GB Palettes", attachParams(),
(bool)system().optionUseBuiltinGBPalette,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().sessionOptionSet();
system().optionUseBuiltinGBPalette = item.flipBoolValue(*this);

View File

@ -81,7 +81,7 @@ void GbcSystem::applyGBPalette()
gbEmu.setDmgPaletteColor(2, i, makeOutputColor(pal.sp2[i]));
}
void GbcSystem::reset(EmuApp &app, ResetMode mode)
void GbcSystem::reset(EmuApp& app, ResetMode)
{
flushBackupMemory(app);
gbEmu.reset();
@ -93,14 +93,14 @@ FS::FileString GbcSystem::stateFilename(int slot, std::string_view name) const
return IG::format<FS::FileString>("{}.0{}.gqs", name, saveSlotCharUpper(slot));
}
void GbcSystem::readState(EmuApp &app, std::span<uint8_t> buff)
void GbcSystem::readState(EmuApp&, std::span<uint8_t> buff)
{
IStream<MapIO> stream{buff};
if(!gbEmu.loadState(stream))
throw std::runtime_error("Invalid state data");
}
size_t GbcSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags)
size_t GbcSystem::writeState(std::span<uint8_t> buff, SaveStateFlags)
{
assert(saveStateSize == buff.size());
OStream<MapIO> stream{buff};

View File

@ -184,7 +184,7 @@ void GbcSystem::clearInputBuffers(EmuInputView &)
gbcInput.bits = 0;
}
SystemInputDeviceDesc GbcSystem::inputDeviceDesc(int idx) const
SystemInputDeviceDesc GbcSystem::inputDeviceDesc(int) const
{
static constexpr std::array gamepadComponents
{

View File

@ -9,7 +9,7 @@ VPATH += $(EMUFRAMEWORK_PATH)/src/shared
CPPFLAGS += $(MDFN_COMMON_CPPFLAGS) \
-I$(projectPath)/src
CXXFLAGS_WARN += -Wno-missing-field-initializers
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-unused-parameter
SRC += main/Main.cc \
main/options.cc \

View File

@ -2,7 +2,7 @@ include $(EMUFRAMEWORK_PATH)/metadata/conf.mk
metadata_name = Lynx.emu
metadata_exec = lynxemu
metadata_pkgName = LynxEmu
metadata_supportedFileExtensions += lnx o
metadata_supportedFileExtensions += lnx lyx o
metadata_id = com.explusalpha.LynxEmu
metadata_vendor = Robert Broglia
pnd_metadata_description = Lynx emulator using components from Mednafen

View File

@ -46,7 +46,7 @@ class CustomFilePathOptionView : public FilePathOptionView, public MainAppHelper
{
pushAndShow(makeViewWithName<DataFileSelectView<ArchivePathSelectMode::exclude>>("BIOS",
app().validSearchPath(FS::dirnameUri(system().biosPath)),
[this](CStringView path, FS::file_type type)
[this](CStringView path, FS::file_type)
{
system().biosPath = path;
logMsg("set BIOS:%s", system().biosPath.data());

View File

@ -42,7 +42,7 @@ bool EmuApp::needsGlobalInstance = true;
EmuSystem::NameFilterFunc EmuSystem::defaultFsFilter =
[](std::string_view name)
{
return endsWithAnyCaseless(name, ".lnx", ".o");
return endsWithAnyCaseless(name, ".lnx", ".lyx", ".o");
};
using namespace Mednafen;
@ -53,7 +53,7 @@ LynxApp::LynxApp(ApplicationInitParams initParams, ApplicationContext &ctx):
const char *EmuSystem::shortSystemName() const { return "Lynx"; }
const char *EmuSystem::systemName() const { return "Lynx"; }
void LynxSystem::reset(EmuApp &, ResetMode mode)
void LynxSystem::reset(EmuApp&, ResetMode)
{
assert(hasContent());
MDFN_DoSimpleCommand(MDFN_MSC_RESET);
@ -65,7 +65,7 @@ FS::FileString LynxSystem::stateFilename(int slot, std::string_view name) const
}
size_t LynxSystem::stateSize() { return stateSizeMDFN(); }
void LynxSystem::readState(EmuApp &app, std::span<uint8_t> buff) { readStateMDFN(app, buff); }
void LynxSystem::readState(EmuApp&, std::span<uint8_t> buff) { readStateMDFN(buff); }
size_t LynxSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags) { return writeStateMDFN(buff, flags); }
void LynxSystem::closeSystem()

View File

@ -119,7 +119,6 @@ uint64 MDFN_GetSettingUI(const char *name_)
int64 MDFN_GetSettingI(const char *name_)
{
std::string_view name{name_};
auto &sys = static_cast<LynxSystem&>(gSystem());
if("filesys.state_comp_level" == name)
return 6;
bug_unreachable("unhandled settingI %s", name_);

View File

@ -9,7 +9,7 @@ CPPFLAGS += -DLSB_FIRST \
-DNO_SYSTEM_PICO
# -DNO_SVP -DNO_SYSTEM_PBC
CFLAGS_WARN += -Wno-missing-field-initializers
CFLAGS_WARN += -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-function
ifeq ($(config_compiler),clang)
# needed for Z80CPU::makeFlagTables()

View File

@ -84,8 +84,6 @@ static const T_GAME_ENTRY database[GAME_CNT] =
void eeprom_init()
{
int i = 0;
/* initialize eeprom */
memset(&eeprom, 0, sizeof(T_EEPROM));
eeprom.sda = eeprom.old_sda = 1;

View File

@ -115,7 +115,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
system().optionVideoSystem.value(),
videoSystemItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == 0)
{
@ -148,7 +148,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
std::min((int)config.region_detect, 4),
regionItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == 0)
{

View File

@ -5,7 +5,7 @@ include $(IMAGINE_PATH)/make/imagineAppBase.mk
# TODO: fix pointer type casts
CFLAGS_LANG += -Werror=implicit-function-declaration -Wno-incompatible-pointer-types
CFLAGS_WARN += -Wno-sign-compare -Wno-switch -Wno-implicit-fallthrough
CFLAGS_WARN += -Wno-sign-compare -Wno-switch -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
BMSX := blueMSX

View File

@ -123,7 +123,7 @@ class CustomSystemOptionView : public SystemOptionView, public MainAppHelper
{
return
{
.onSetDisplayString = [](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == -1)
{
@ -564,7 +564,7 @@ private:
0,
machineItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == -1)
{

View File

@ -13,7 +13,7 @@ main/EmuMenuViews.cc
CPPFLAGS += -I$(projectPath)/src \
-DHAVE_CONFIG_H -DLSB_FIRST
CFLAGS_WARN += -Wno-sign-compare
CFLAGS_WARN += -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function
ifeq ($(config_compiler),clang)
# needed for Z80CPU::makeFlagTables()

View File

@ -66,7 +66,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
std::min((int)system().optionTimerInt, 2),
timerItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text& t)
{
if(idx == 2)
{

View File

@ -119,7 +119,6 @@ uint8_t *gn_unzip_file_malloc(PKZIP *archPtr, const char *filename, uint32_t fil
struct PKZIP *open_rom_zip(void *contextPtr, char *romPath, char *name)
{
auto &ctx = *((IG::ApplicationContext*)contextPtr);
auto baseUri = FS::uriString(romPath, name);
// Try to open each possible archive type
if(auto gz = gn_open_zip(contextPtr, FS::PathString{baseUri + ".zip"}.data());

View File

@ -18,7 +18,8 @@ CPPFLAGS += -I$(projectPath)/src \
-DFRAMESKIP \
-I$(projectPath)/src/fceu
CXXFLAGS_WARN += -Wno-register -Wno-sign-compare -Wno-missing-field-initializers -Wno-switch -Wno-bitwise-op-parentheses -Wno-expansion-to-defined
CXXFLAGS_WARN += -Wno-register -Wno-sign-compare -Wno-missing-field-initializers -Wno-switch \
-Wno-bitwise-op-parentheses -Wno-expansion-to-defined -Wno-unused-local-typedefs -Wno-unused-parameter
ifneq ($(config_compiler), clang)
CXXFLAGS_WARN += -Wno-volatile

View File

@ -218,7 +218,7 @@ EmuEditCheatView::EmuEditCheatView(ViewAttachParams attach, unsigned cheatIdx, R
int compare;
{
std::string nameStr{};
int gotCheat = FCEUI_GetCheat(cheatIdx, &nameStr, &a, &v, &compare, 0, &type);
FCEUI_GetCheat(cheatIdx, &nameStr, &a, &v, &compare, 0, &type);
logMsg("got cheat with addr 0x%.4x val 0x%.2x comp %d", a, v, compare);
name.setName(std::move(nameStr));
}

View File

@ -31,8 +31,8 @@ public:
~EmuFileIO() = default;
FILE *get_fp() final { return nullptr; }
EMUFILE* memwrap() final { return nullptr; }
void truncate(size_t length) final {}
int fprintf(const char *format, ...) final { return 0; };
void truncate(size_t) final {}
int fprintf(const char*, ...) final { return 0; };
int fgetc() final;
int fputc(int c) final;
size_t _fread(const void *ptr, size_t bytes) final;

View File

@ -118,7 +118,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
MenuId{system().optionVideoSystem},
videoSystemItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text &t)
{
if(idx == 0)
{
@ -698,7 +698,7 @@ private:
TextMenuItem insertEject
{
"Eject", attachParams(),
[this](View &view, Input::Event e)
[](View& view)
{
if(FCEU_FDSInserted())
{

View File

@ -88,8 +88,8 @@ std::span<const KeyCategory> NesApp::keyCategories()
{
KeyCategory{"Gamepad", gpKeyInfo},
KeyCategory{"Gamepad 2", gp2KeyInfo, 1},
KeyCategory{"Gamepad 3", gp2KeyInfo, 2},
KeyCategory{"Gamepad 4", gp2KeyInfo, 3},
KeyCategory{"Gamepad 3", gp3KeyInfo, 2},
KeyCategory{"Gamepad 4", gp4KeyInfo, 3},
KeyCategory{"Extra Functions", exKeyInfo},
};
return categories;
@ -237,8 +237,9 @@ void NesSystem::handleInputAction(EmuApp *app, InputAction a)
{
if(!isFDS || !a.isPushed())
return;
EmuSystemTask::SuspendContext suspendCtx;
if(app)
app->syncEmulationThread();
suspendCtx = app->suspendEmulationThread();
if(FCEU_FDSInserted())
{
FCEU_FDSInsert();

View File

@ -9,7 +9,7 @@ VPATH += $(EMUFRAMEWORK_PATH)/src/shared
CPPFLAGS += $(MDFN_COMMON_CPPFLAGS) \
-I$(projectPath)/src
CXXFLAGS_WARN += -Wno-missing-field-initializers
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-unused-parameter
SRC += main/Main.cc \
main/options.cc \

View File

@ -71,7 +71,7 @@ FS::FileString NgpSystem::stateFilename(int slot, std::string_view name) const
}
size_t NgpSystem::stateSize() { return stateSizeMDFN(); }
void NgpSystem::readState(EmuApp &app, std::span<uint8_t> buff) { readStateMDFN(app, buff); }
void NgpSystem::readState(EmuApp&, std::span<uint8_t> buff) { readStateMDFN(buff); }
size_t NgpSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags) { return writeStateMDFN(buff, flags); }
static FS::PathString saveFilename(const EmuApp &app)
@ -163,7 +163,7 @@ void system_io_flash_write(uint8_t* buffer, uint32 len)
return;
auto saveStr = saveFilename(gApp());
logMsg("writing flash %s", saveStr.data());
IG::FileUtils::writeToUri(gAppContext(), saveStr, {buffer, len}) != -1;
IG::FileUtils::writeToUri(gAppContext(), saveStr, {buffer, len});
}
}

View File

@ -12,7 +12,7 @@ CPPFLAGS += $(MDFN_COMMON_CPPFLAGS) \
-I$(EMUFRAMEWORK_PATH)/src/shared/mednafen/hw_misc \
-I$(EMUFRAMEWORK_PATH)/src/shared/mednafen/hw_sound
CXXFLAGS_WARN += -Wno-missing-field-initializers
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-function
SRC += main/Main.cc \
main/options.cc \

View File

@ -211,7 +211,7 @@ void PceSystem::reset(EmuApp &, ResetMode mode)
}
size_t PceSystem::stateSize() { return stateSizeMDFN(); }
void PceSystem::readState(EmuApp &app, std::span<uint8_t> buff) { readStateMDFN(app, buff); }
void PceSystem::readState(EmuApp&, std::span<uint8_t> buff) { readStateMDFN(buff); }
size_t PceSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags) { return writeStateMDFN(buff, flags); }
double PceSystem::videoAspectRatioScale() const
@ -267,7 +267,7 @@ static void renderMultiresOutput(EmulateSpecStruct spec, IG::PixmapView srcPix,
bug_unreachable("width == %d", width);
case 256:
{
for(auto w : IG::iotaCount(256))
for([[maybe_unused]] auto w : IG::iotaCount(256))
{
*destPixAddr++ = *srcPixAddr;
*destPixAddr++ = *srcPixAddr;
@ -278,7 +278,7 @@ static void renderMultiresOutput(EmulateSpecStruct spec, IG::PixmapView srcPix,
}
case 341:
{
for(auto w : IG::iotaCount(340))
for([[maybe_unused]] auto w : IG::iotaCount(340))
{
*destPixAddr++ = *srcPixAddr;
*destPixAddr++ = *srcPixAddr;
@ -292,7 +292,7 @@ static void renderMultiresOutput(EmulateSpecStruct spec, IG::PixmapView srcPix,
}
case 512:
{
for(auto w : IG::iotaCount(512))
for([[maybe_unused]] auto w : IG::iotaCount(512))
{
*destPixAddr++ = *srcPixAddr;
*destPixAddr++ = *srcPixAddr++;
@ -315,7 +315,7 @@ static void renderMultiresOutput(EmulateSpecStruct spec, IG::PixmapView srcPix,
bug_unreachable("width == %d", width);
case 256:
{
for(auto w : IG::iotaCount(256))
for([[maybe_unused]] auto w : IG::iotaCount(256))
{
*destPixAddr++ = *srcPixAddr;
*destPixAddr++ = *srcPixAddr++;

View File

@ -80,7 +80,7 @@ std::span<const KeyCategory> PceApp::keyCategories()
KeyCategory{"Gamepad 2", gp2KeyInfo, 1},
KeyCategory{"Gamepad 3", gp3KeyInfo, 2},
KeyCategory{"Gamepad 4", gp4KeyInfo, 3},
KeyCategory{"Gamepad 5", gp4KeyInfo, 4},
KeyCategory{"Gamepad 5", gp5KeyInfo, 4},
};
return categories;
}

View File

@ -10,7 +10,7 @@ CPPFLAGS += $(MDFN_COMMON_CPPFLAGS) \
$(MDFN_CDROM_CPPFLAGS) \
-I$(projectPath)/src
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-deprecated-enum-enum-conversion
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-deprecated-enum-enum-conversion -Wno-unused-parameter -Wno-unused-function
SRC += main/Main.cc \
main/options.cc \

View File

@ -201,7 +201,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
MenuId{system().cartType},
cartTypeItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text &t)
{
if(idx == 0)
{
@ -238,7 +238,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
MenuId{system().region},
regionItems,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [](auto idx, Gfx::Text &t)
{
if(idx == 0)
{

View File

@ -425,7 +425,7 @@ double SaturnSystem::videoAspectRatioScale() const
}
size_t SaturnSystem::stateSize() { return currStateSize; }
void SaturnSystem::readState(EmuApp &app, std::span<uint8_t> buff) { readStateMDFN(app, buff); }
void SaturnSystem::readState(EmuApp&, std::span<uint8_t> buff) { readStateMDFN(buff); }
size_t SaturnSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags) { return writeStateMDFN(buff, flags); }
void EmuApp::onCustomizeNavView(EmuApp::NavView &view)

View File

@ -33,7 +33,7 @@
namespace EmuEx
{
constexpr SystemLogger log{"Saturn.emu"};
[[maybe_unused]] constexpr SystemLogger log{"Saturn.emu"};
const int EmuSystem::maxPlayers = 12;
enum class SaturnKey : KeyCode

View File

@ -206,7 +206,7 @@ EmuEditCheatView::EmuEditCheatView(ViewAttachParams attach, int cheatIdx, Refres
"Address",
u"",
attach,
[this](DualTextMenuItem &item, View &, Input::Event e)
[this](const Input::Event& e)
{
pushAndShowNewCollectValueInputView<const char*>(attachParams(), e, "Input 6-digit hex", addrStr.data(),
[this](CollectTextInputView&, auto str)
@ -242,7 +242,7 @@ EmuEditCheatView::EmuEditCheatView(ViewAttachParams attach, int cheatIdx, Refres
"Value",
u"",
attach,
[this](DualTextMenuItem &item, View &, Input::Event e)
[this](const Input::Event& e)
{
pushAndShowNewCollectValueInputView<const char*>(attachParams(), e, "Input 2-digit hex", valueStr.data(),
[this](CollectTextInputView&, const char *str)
@ -281,7 +281,7 @@ EmuEditCheatView::EmuEditCheatView(ViewAttachParams attach, int cheatIdx, Refres
#endif
u"",
attach,
[this](DualTextMenuItem &item, View &, Input::Event e)
[this](const Input::Event& e)
{
pushAndShowNewCollectTextInputView(attachParams(), e, "Input 2-digit hex or blank", savedStr.data(),
[this](CollectTextInputView &view, const char *str)
@ -383,8 +383,8 @@ EmuEditCheatListView::EmuEditCheatListView(ViewAttachParams attach):
{
return msg.visit(overloaded
{
[&](const ItemsMessage &m) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage &m) -> ItemReply
[&](const ItemsMessage&) -> ItemReply { return 1 + cheat.size(); },
[&](const GetItemMessage& m) -> ItemReply
{
switch(m.idx)
{
@ -398,7 +398,7 @@ EmuEditCheatListView::EmuEditCheatListView(ViewAttachParams attach):
addCode
{
"Add Game Genie/Action Replay/Gold Finger Code", attach,
[this](TextMenuItem &item, View &, Input::Event e)
[this](const Input::Event& e)
{
if(numCheats() == EmuCheats::MAX)
{
@ -464,7 +464,7 @@ void EmuCheatsView::loadCheatItems()
for(auto c : iotaCount(cheats))
{
cheat.emplace_back(cheatName(c), attachParams(), cheatIsEnabled(c),
[this, c](BoolMenuItem &item, View &, Input::Event e)
[this, c](BoolMenuItem &item)
{
bool on = item.flipBoolValue(*this);
if(on)

View File

@ -65,7 +65,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
{
"5-Player Adapter", attachParams(),
(bool)system().optionMultitap,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().sessionOptionSet();
system().optionMultitap = item.flipBoolValue(*this);
@ -130,7 +130,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
{
"Allow Extended 239/478 Lines", attachParams(),
(bool)system().optionAllowExtendedVideoLines,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().sessionOptionSet();
system().optionAllowExtendedVideoLines = item.flipBoolValue(*this);
@ -164,7 +164,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
{
"Allow Invalid VRAM Access", attachParams(),
(bool)!system().optionBlockInvalidVRAMAccess,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().sessionOptionSet();
system().optionBlockInvalidVRAMAccess = !item.flipBoolValue(*this);
@ -176,7 +176,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
{
"Separate Echo Buffer From Ram", attachParams(),
(bool)system().optionSeparateEchoBuffer,
[this](BoolMenuItem &item, View &, Input::Event e)
[this](BoolMenuItem &item)
{
system().sessionOptionSet();
system().optionSeparateEchoBuffer = item.flipBoolValue(*this);
@ -230,7 +230,7 @@ class ConsoleOptionView : public TableView, public MainAppHelper
}(),
superFXClockItem,
{
.onSetDisplayString = [this](auto idx, Gfx::Text &t)
.onSetDisplayString = [this](auto, Gfx::Text& t)
{
t.resetString(std::format("{}%", system().optionSuperFXClockMultiplier.value()));
return true;
@ -351,7 +351,7 @@ class CustomFilePathOptionView : public FilePathOptionView, public MainAppHelper
{
pushAndShow(makeViewWithName<DataFileSelectView<>>("BS-X BIOS",
app().validSearchPath(FS::dirnameUri(system().bsxBiosPath)),
[this](CStringView path, FS::file_type type)
[this](CStringView path, FS::file_type)
{
system().bsxBiosPath = path;
logMsg("set BS-X bios:%s", path.data());
@ -373,7 +373,7 @@ class CustomFilePathOptionView : public FilePathOptionView, public MainAppHelper
{
pushAndShow(makeViewWithName<DataFileSelectView<>>("Sufami Turbo BIOS",
app().validSearchPath(FS::dirnameUri(system().sufamiBiosPath)),
[this](CStringView path, FS::file_type type)
[this](CStringView path, FS::file_type)
{
system().sufamiBiosPath = path;
logMsg("set Sufami Turbo bios:%s", path.data());

View File

@ -56,7 +56,7 @@ EmuSystem::NameFilterFunc EmuSystem::defaultFsFilter =
Snes9xApp::Snes9xApp(ApplicationInitParams initParams, ApplicationContext &ctx):
EmuApp{initParams, ctx}, snes9xSystem{ctx} {}
const BundledGameInfo &EmuSystem::bundledGameInfo(int idx) const
const BundledGameInfo &EmuSystem::bundledGameInfo(int) const
{
static constexpr BundledGameInfo info[]
{
@ -86,7 +86,7 @@ MutablePixmapView Snes9xSystem::fbPixmapView(WSize size, bool useInterlaceFields
return pix;
}
void Snes9xSystem::renderFramebuffer(EmuVideo &video)
void Snes9xSystem::renderFramebuffer(EmuVideo&)
{
emuSysTask = {};
S9xDeinitUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);

View File

@ -170,11 +170,11 @@ const char *S9xBasename(const char *f)
#else
void S9xHandlePortCommand(s9xcommand_t cmd, int16 data1, int16 data2) {}
void S9xHandlePortCommand(s9xcommand_t, int16, int16) {}
bool8 S9xOpenSoundDevice() { return TRUE; }
const char *S9xGetCrosshair(int idx) { return nullptr; }
const char *S9xGetCrosshair(int) { return nullptr; }
std::string S9xGetFilenameInc(std::string_view, enum s9x_getdirtype dirtype)
std::string S9xGetFilenameInc(std::string_view, enum s9x_getdirtype)
{
logErr("S9xGetFilenameInc not used yet");
return {};
@ -195,7 +195,7 @@ std::string S9xGetFilename(std::string_view ex, enum s9x_getdirtype dirtype)
return std::string{sys.contentSaveFilePath(ex)};
}
std::string S9xGetFilename(std::string_view filename, std::string_view ex, enum s9x_getdirtype dirtype)
std::string S9xGetFilename(std::string_view, std::string_view ex, enum s9x_getdirtype dirtype)
{
return S9xGetFilename(ex, dirtype);
}
@ -264,12 +264,12 @@ std::string S9xBasename(std::string_view f)
#endif
bool S9xPollAxis(uint32 id, int16 *value)
bool S9xPollAxis(uint32, int16*)
{
return 0;
}
bool S9xPollPointer(uint32 id, int16 *x, int16 *y)
bool S9xPollPointer(uint32, int16*, int16*)
{
return 0;
}
@ -291,7 +291,7 @@ void S9xToggleSoundChannel(int c)
S9xSetSoundControl(sound_switch);
}
const char * S9xStringInput(const char *message)
const char * S9xStringInput(const char*)
{
bug_unreachable("should not be called");
return 0;

View File

@ -83,7 +83,7 @@ std::span<const KeyCategory> Snes9xApp::keyCategories()
KeyCategory{"Gamepad 2", gp2KeyInfo, 1},
KeyCategory{"Gamepad 3", gp3KeyInfo, 2},
KeyCategory{"Gamepad 4", gp4KeyInfo, 3},
KeyCategory{"Gamepad 5", gp4KeyInfo, 4},
KeyCategory{"Gamepad 5", gp5KeyInfo, 4},
};
return categories;
}
@ -239,7 +239,7 @@ void Snes9xSystem::handleInputAction(EmuApp *, InputAction a)
padData = setOrClearBits(padData, bit(a.code), a.isPushed());
}
void Snes9xSystem::clearInputBuffers(EmuInputView &view)
void Snes9xSystem::clearInputBuffers(EmuInputView&)
{
for(auto p : iotaCount(maxPlayers))
{
@ -587,7 +587,7 @@ bool Snes9xSystem::onPointerInputEnd(const Input::MotionEvent &e, Input::DragTra
return false;
}
SystemInputDeviceDesc Snes9xSystem::inputDeviceDesc(int idx) const
SystemInputDeviceDesc Snes9xSystem::inputDeviceDesc(int) const
{
static constexpr std::array gamepadComponents
{

View File

@ -9,7 +9,7 @@ VPATH += $(EMUFRAMEWORK_PATH)/src/shared
CPPFLAGS += $(MDFN_COMMON_CPPFLAGS) \
-I$(projectPath)/src
CXXFLAGS_WARN += -Wno-missing-field-initializers
CXXFLAGS_WARN += -Wno-missing-field-initializers -Wno-unused-parameter
SRC += main/Main.cc \
main/options.cc \

View File

@ -68,7 +68,7 @@ FS::FileString WsSystem::stateFilename(int slot, std::string_view name) const
}
size_t WsSystem::stateSize() { return stateSizeMDFN(); }
void WsSystem::readState(EmuApp &app, std::span<uint8_t> buff) { readStateMDFN(app, buff); }
void WsSystem::readState(EmuApp&, std::span<uint8_t> buff) { readStateMDFN(buff); }
size_t WsSystem::writeState(std::span<uint8_t> buff, SaveStateFlags flags) { return writeStateMDFN(buff, flags); }
void WsSystem::loadBackupMemory(EmuApp &app)

View File

@ -56,7 +56,7 @@ public:
class NullOutputStream
{
public:
StreamError open(OutputStreamConfig config) { return {}; }
StreamError open(OutputStreamConfig) { return {}; }
void play() {}
void pause() {}
void close() {}

Some files were not shown because too many files have changed in this diff Show More