简体中文 | English
implementation 'io.github.beseting:NesEmulator:1.0.1'
//It is recommended to initialize the SDK in the Application
EmulatorSDK.init(appContext)
EmulatorManager.getInstance()
//is show view controller(default:true)
.set(EmulatorManager.Settings.SHOW_CONTROLLER, false)
//emulator display quality(default:MEDIUM)
.set(EmulatorManager.Settings.EMULATION_QUALITY,
EmulatorManager.EmulationQuality.MEDIUM)
//emulator screen orientation(default:AUTO)
.set(EmulatorManager.Settings.SCREEN_ORIENTATION,
EmulatorManager.EmulatorScreenOrientation.AUTO)
//is force emulator display fullscreen(default:false)
.set(EmulatorManager.Settings.FORCE_FULL_SCREEN, false)
val romFile = File("/sdcard/contra.nes")
EmulatorManager.getInstance().startGame(mActivity, romFile)
//Custom Activity
class MyEmulatorActivity : BaseEmulatorActivity(){
//Customizable Display Controller(Direction&A/B Button)
//If You Want Custom Display Controller,You Can Hide The Default Show.
override fun getLayoutResId(): Int {
return R.layout.activity_nes_emulator
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Write Your Code...
}
}
val romFile = File("/sdcard/contra.nes")
EmulatorManager.getInstance()
.startGame(mAct, MyEmulatorActivity::class.java,romFile)
//Controller Key Press
EmulatorManager.getInstance().pressKey(player, key)
//Controller Key Unpress
EmulatorManager.getInstance().unPressKey(player, key)
Player(Role) | Description |
---|---|
PLAYER1 | 1P |
PLAYER2 | 2P |
Use:EmulatorManager.Player.PLAYER1
ControllerKey(Controller Key) | Description |
---|---|
UP | direction for up |
DOWN | direction for down |
LEFT | direction for left |
RIGHT | direction for right |
SELECT | button for select |
START | button for start |
A | button for A |
B | button for B |
A_TURBO | button for A Turbo |
B_TURBO | button for B Turbo |
Use:EmulatorManager.ControllerKey.UP
Settings | Type | Default | Description |
---|---|---|---|
SHOW_CONTROLLER | Boolean | true | is show default controller |
EMULATION_QUALITY | EmulationQuality | MEDIUM | display quality |
SCREEN_ORIENTATION | EmulatorScreenOrientation | AUTO | screen direction |
FORCE_FULL_SCREEN | Boolean | false | is force fullscreen |
Use:EmulatorManager.Settings.SHOW_CONTROLLER
This library is based on NostalgiaLite to develop plus,Thanks the author huzongyao provided based on Android Studio NDK's compilable for Jni/C++ code.NesEmulator library provide the fully compiled so library(arm64-v8a、armeabi-v7a、x86),As your need,Provide SDK capabilities,Package the API,Fast develop.Enjoy it!