Skip to content

Commit

Permalink
keira: nesapp: fix string going out of scope before nofrendo starts
Browse files Browse the repository at this point in the history
  • Loading branch information
and3rson committed Apr 14, 2024
1 parent b3603fe commit 8748834
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion firmware/keira/src/apps/nes/nesapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
#include "driver.h"

NesApp::NesApp(String path) : App("NES", 0, 0, lilka::display.width(), lilka::display.height()) {
argv[0] = const_cast<char*>(path.c_str());
argv[0] = new char[path.length() + 1];
strcpy(argv[0], path.c_str());
setFlags(AppFlags::APP_FLAG_FULLSCREEN);
}

NesApp::~NesApp() {
delete[] argv[0];
}

void NesApp::run() {
// Load the ROM
Driver::setNesApp(this);
Expand Down
1 change: 1 addition & 0 deletions firmware/keira/src/apps/nes/nesapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class NesApp : public App {
public:
explicit NesApp(String path);
~NesApp();

private:
void run();
Expand Down

0 comments on commit 8748834

Please sign in to comment.