forked from strato-emu/strato
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworks the API a fair bit and adds documentation to almost everything.
- Loading branch information
Showing
43 changed files
with
2,022 additions
and
681 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
LightSwitch, a Nintendo Switch emulator for Android | ||
Skyline, a Nintendo Switch emulator for Android | ||
============= | ||
|
||
LightSwitch is an experimental Nintendo Switch emulator for Android phones, licensed under GPLv3. Please refer to the [license file](https://github.com/lightswitch-emu/lightswitch/blob/master/LICENSE) for more information. It currently does not run any games, nor Homebrew. It has no graphical output as of now. | ||
Skyline is an experimental Nintendo Switch emulator for Android phones, licensed under GPLv3. Please refer to the [license file](https://github.com/lightswitch-emu/lightswitch/blob/master/LICENSE) for more information. It currently does not run any games, nor Homebrew. It has no graphical output as of now. | ||
|
||
### Contact | ||
You can contact the core developers of LightSwitch at our [Discord](https://discord.gg/XnbXNQM). If you have any questions, feel free to ask. | ||
You can contact the core developers of Skyline at our [Discord](https://discord.gg/XnbXNQM). If you have any questions, feel free to ask. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,43 @@ | ||
#include <jni.h> | ||
#include <string> | ||
#include <pthread.h> | ||
#include <csignal> | ||
#include <string> | ||
#include <thread> | ||
#include <pthread.h> | ||
#include "switch/device.h" | ||
#include "switch/common.h" | ||
#include "switch/os.h" | ||
|
||
std::thread *emu_thread; | ||
bool halt = false; | ||
|
||
void thread_main(std::string rom_path, std::string pref_path, std::string log_path) { | ||
auto log = std::make_shared<lightSwitch::Logger>(log_path); | ||
log->write(lightSwitch::Logger::INFO, "Launching ROM {0}", rom_path); | ||
|
||
auto settings = std::make_shared<lightSwitch::Settings>(pref_path); | ||
try { | ||
lightSwitch::device device(log, settings); | ||
device.run(rom_path); | ||
|
||
log->write(lightSwitch::Logger::INFO, "Emulation has ended."); | ||
lightSwitch::kernel::OS os(log, settings); | ||
log->Write(lightSwitch::Logger::INFO, "Launching ROM {}", rom_path); | ||
os.Execute(rom_path); | ||
log->Write(lightSwitch::Logger::INFO, "Emulation has ended"); | ||
} catch (std::exception &e) { | ||
log->write(lightSwitch::Logger::ERROR, e.what()); | ||
log->Write(lightSwitch::Logger::ERROR, e.what()); | ||
} catch (...) { | ||
log->write(lightSwitch::Logger::ERROR, "An unknown exception has occurred."); | ||
log->Write(lightSwitch::Logger::ERROR, "An unknown exception has occurred"); | ||
} | ||
} | ||
|
||
extern "C" | ||
JNIEXPORT void JNICALL | ||
Java_emu_lightswitch_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring rom_path_, jstring pref_path_, jstring log_path_) { | ||
const char *rom_path = env->GetStringUTFChars(rom_path_, 0); | ||
const char *pref_path = env->GetStringUTFChars(pref_path_, 0); | ||
const char *log_path = env->GetStringUTFChars(log_path_, 0); | ||
extern "C" JNIEXPORT void JNICALL Java_emu_lightswitch_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring rom_path_, jstring pref_path_, jstring log_path_) { | ||
const char *rom_path = env->GetStringUTFChars(rom_path_, nullptr); | ||
const char *pref_path = env->GetStringUTFChars(pref_path_, nullptr); | ||
const char *log_path = env->GetStringUTFChars(log_path_, nullptr); | ||
|
||
if (emu_thread) { | ||
halt=true; // This'll cause execution to stop after the next breakpoint | ||
halt = true; // This'll cause execution to stop after the next breakpoint | ||
emu_thread->join(); | ||
} | ||
// Running on UI thread is not a good idea, any crashes and such will be propagated | ||
|
||
// Running on UI thread is not a good idea as the UI will remain unresponsive | ||
emu_thread = new std::thread(thread_main, std::string(rom_path, strlen(rom_path)), std::string(pref_path, strlen(pref_path)), std::string(log_path, strlen(log_path))); | ||
|
||
env->ReleaseStringUTFChars(rom_path_, rom_path); | ||
env->ReleaseStringUTFChars(pref_path_, pref_path); | ||
env->ReleaseStringUTFChars(log_path_, log_path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.