Code Monkey home page Code Monkey logo

ktnes's Introduction

ktnes

A NES emulator implemented in Kotlin using multiplatform support and Kotlin/Native.

Inspired on the following prior work:

Demo

super mario bros 3 the legend of zelda

Android implementation

You should be able to build and run directly from Android Studio.

If you'd rather use Gradle, run:

./gradlew android:installDebug

Javascript implementation

To build/run the Javascript version of the emulator, run:

./gradlew web:run

Then, open http://localhost:8080 on your browser.

Status

Still under active development.

Sound works but is still a bit garbled/distorted.

Implemented mappers:

  • Mapper 0
  • Mapper 1
  • Mapper 4 (MMC3)

License

Copyright 2020 Felipe Lima

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

ktnes's People

Contributors

dturner avatar felipecsl avatar feresr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ktnes's Issues

Can't find `felipe--kotlin-new-mpp-SNAPSHOT`

I'm trying to get this project set up and to play around with it and I keep getting:

Could not find com.github.felipecsl.kotlin-frontend-plugin:kotlin-frontend:felipe--kotlin-new-mpp-SNAPSHOT.
Searched in the following locations:
  - file:/Users/feresr/.m2/repository/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - file:/Users/feresr/.m2/repository/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - file:/Users/feresr/.m2/repository/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://jcenter.bintray.com/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://jcenter.bintray.com/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://jcenter.bintray.com/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://dl.google.com/dl/android/maven2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://dl.google.com/dl/android/maven2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://dl.google.com/dl/android/maven2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://kotlin.bintray.com/kotlinx/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://kotlin.bintray.com/kotlinx/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://kotlin.bintray.com/kotlinx/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://plugins.gradle.org/m2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://plugins.gradle.org/m2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://plugins.gradle.org/m2/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://oss.sonatype.org/content/repositories/snapshots/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://oss.sonatype.org/content/repositories/snapshots/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://oss.sonatype.org/content/repositories/snapshots/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://dl.bintray.com/kotlin/kotlin-eap/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://dl.bintray.com/kotlin/kotlin-eap/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://dl.bintray.com/kotlin/kotlin-eap/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://dl.bintray.com/kotlin/kotlin-dev/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://dl.bintray.com/kotlin/kotlin-dev/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.module
  - https://dl.bintray.com/kotlin/kotlin-dev/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-SNAPSHOT.pom
  - https://jitpack.io/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/maven-metadata.xml
  - https://jitpack.io/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-0.0.37-g96c7e0f-3.module
  - https://jitpack.io/com/github/felipecsl/kotlin-frontend-plugin/kotlin-frontend/felipe--kotlin-new-mpp-SNAPSHOT/kotlin-frontend-felipe--kotlin-new-mpp-0.0.37-g96c7e0f-3.pom
Required by:
    project : > com.github.felipecsl:kotlin-frontend-plugin:felipe--kotlin-new-mpp-SNAPSHOT:0.0.37-g96c7e0f-3

Inclusion in F-Droid

Hi,

Since this app is Apache 2 licensed, are you considering the fact to add it to F-Droid? There is a strong community behind.

You can find some documentation here.

Otherwise, if you don't want to work on the inclusion of this app by yourself, would it be ok for you if someone else do it for you?

Getting error when building in AS: Unresolved reference: raw

After following the build instructions I imported the ktnes project into Android Studio.

When attempting to run the app on my Pixel XL (running Android 9.0 Pie) I get the following error:

e: /Users/donturner/Code/workspace-android/ktnes/android/app/src/main/kotlin/com/felipecsl/knes/app/MainActivity.kt: (148, 23): Unresolved reference: raw

Fix audio glitches

Right now, audio is far from perfect on both mobile and web versions of ktnes. While it's still recognizable, it's full of glitches that make it quite annoying.

Apks? And more

Can you post apks when you update your app so mobile users can get this emulator easier.

Is this coming to Google Play?

And can it load headerless roms like the Mesen emulator

Sorry if this is in the wrong section, I'm new to GitHub

JNI crash use of deleted local reference 0x200021

I encountered a JNI error (Android 7.0 Meizu PRO 7-S):
A/art: art/runtime/java_vm_ext.cc:496] JNI DETECTED ERROR IN APPLICATION: use of deleted local reference 0x200021
...
art/runtime/runtime.cc:406] "main" prio=5 tid=1 Runnable
art/runtime/runtime.cc:406] | group="" sCount=0 dsCount=0 obj=0x7520c768 self=0x76ac496a00
art/runtime/runtime.cc:406] | sysTid=13003 nice=0 cgrp=default sched=0/0 handle=0x76b0b5da98
art/runtime/runtime.cc:406] | state=R schedstat=( 1228365157 308057765 1518 ) utm=111 stm=11 core=5 HZ=100
art/runtime/runtime.cc:406] | stack=0x7fd33f8000-0x7fd33fa000 stackSize=8MB
art/runtime/runtime.cc:406] | held mutexes= "mutator lock"(shared held)
art/runtime/runtime.cc:406] native: #00 pc 000000000047cd80 /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
art/runtime/runtime.cc:406] native: #1 pc 000000000047cd7c /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
art/runtime/runtime.cc:406] native: #2 pc 0000000000450ef8 /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+480)
art/runtime/runtime.cc:406] native: #3 pc 0000000000468a6c /system/lib64/libart.so (ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+832)
art/runtime/runtime.cc:406] native: #4 pc 0000000000451e5c /system/lib64/libart.so (ZN3art6Thread21RunCheckpointFunctionEv+192)
art/runtime/runtime.cc:406] native: #5 pc 000000000054be88 /system/lib64/libart.so (artTestSuspendFromCode+24)
art/runtime/runtime.cc:406] native: #6 pc 00000000000db9d4 /system/lib64/libart.so (art_quick_test_suspend+68)
art/runtime/runtime.cc:406] native: #7 pc 00000000001c34d4 /data/dalvik-cache/arm64/system@[email protected] (Java_java_util_ArrayList_00024Itr_next
+320)
art/runtime/runtime.cc:406] at java.util.ArrayList$Itr.next(ArrayList.java:830)
art/runtime/runtime.cc:406] at kotlin.collections.CollectionsKt___CollectionsKt.toIntArray(_Collections.kt:1013)
art/runtime/runtime.cc:406] at com.felipecsl.knes.INESFileParser$Companion.parseCartridge(INESFileParser.kt:49)
art/runtime/runtime.cc:406] at com.felipecsl.knes.Director.(Director.kt:17)
art/runtime/runtime.cc:406] at com.felipecsl.knes.Director.(Director.kt:14)
art/runtime/runtime.cc:406] at com.felipecsl.knes.app.MainActivity.startConsole(MainActivity.kt:125)
art/runtime/runtime.cc:406] at com.felipecsl.knes.app.MainActivity.onClickPlayPause(MainActivity.kt:91)
art/runtime/runtime.cc:406] at com.felipecsl.knes.app.MainActivity.access$onClickPlayPause(MainActivity.kt:21)
art/runtime/runtime.cc:406] at com.felipecsl.knes.app.MainActivity$onCreate$1.onClick(MainActivity.kt:70)
art/runtime/runtime.cc:406] at android.view.View.performClick(View.java:5730)
art/runtime/runtime.cc:406] at android.view.View$PerformClick.run(View.java:22808)
art/runtime/runtime.cc:406] at android.os.Handler.handleCallback(Handler.java:836)
art/runtime/runtime.cc:406] at android.os.Handler.dispatchMessage(Handler.java:103)
art/runtime/runtime.cc:406] at android.os.Looper.loop(Looper.java:203)
art/runtime/runtime.cc:406] at android.app.ActivityThread.main(ActivityThread.java:6494)
art/runtime/runtime.cc:406] at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:406] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
art/runtime/runtime.cc:406] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)
art/runtime/runtime.cc:406]
art/runtime/runtime.cc:406] "Jit thread pool worker thread 0" prio=10 tid=2 Native (still starting up)

It is working well on Android 5.1.

Distribution of Oboe?

Would it be preferable to you to have a binary distribution of Oboe? e.g. libOboe.so for each target architecture?

This would save your users from having to independently download Oboe in order to build ktnes. Or is there some other way you could introduce the Oboe dependency so that the source is downloaded automatically?

Really just interested in making Oboe as easy for developers to use as possible so interested in your thoughts.

Add save/restore state functionality

Should also be keyed by the rom name, just one save per game should be enough for now.
We'll likely need to stop the console first, restore state then resume

Stabilize CPU clock speed

The console clock will run as fast or as slow as the device/environment that's running it can go.
This is especially problematic on Android where performance can vary drastically so on high end devices could run so fast that makes it actually unplayable.
We should automatically adjust the iteration speed so that it's closest to the actual NES clock.

Crash everytime on Xiaomi Mi4 , Google Pixel 2

Can't not load nes file, just black screen, and when if i press any button it will crash.

06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at java.lang.Integer.valueOf(Integer.java:742)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.INESFileParser$Companion.parseCartridge(INESFileParser.kt:49)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.Director.<init>(Director.kt:13)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.Director.<init>(Director.kt:10)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.app.MainActivity.startConsole(MainActivity.kt:122)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.app.MainActivity.onClickPlayPause(MainActivity.kt:89)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.app.MainActivity.access$onClickPlayPause(MainActivity.kt:21)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at com.felipecsl.knes.app.MainActivity$onCreate$1.onClick(MainActivity.kt:67)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at android.view.View.performClick(View.java:5215)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at android.view.View$PerformClick.run(View.java:21193)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at android.os.Handler.handleCallback(Handler.java:742)
06-05 12:58:30.643 6634-7180/com.felipecsl.knes A/art: art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:95)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.