Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NanoBoyAdvance v35 #5482

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ menu "Emulators"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/emulators/openmsx/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/emulators/demul/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/emulators/xenia/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/emulators/nba/Config.in"

menu "ports"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/ports/devilutionx/Config.in"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python

import Command
from generators.Generator import Generator
import controllersConfig
from shutil import copyfile
import os
import batoceraFiles
import filecmp
from distutils.dir_util import copy_tree

nba_file = "/usr/nba/NanoBoyAdvance"
nba_Config = "/usr/nba/"
nba_Homedir = batoceraFiles.CONF + "/nba"

class NbaGenerator(Generator):

def generate(self, system, rom, playersControllers, gameResolution):
nba_exec = nba_Homedir + "/NanoBoyAdvance"
shader_dir = nba_Homedir + "/shader"

# Create Folder
if not os.path.exists(nba_Homedir):
os.makedirs(nba_Homedir)

# Copy File Needed
if not os.path.exists(shader_dir):
copy_tree(nba_Config, nba_Homedir)

if not os.path.exists(nba_exec) or not filecmp.cmp(nba_file, nba_exec):
copyfile(nba_file, nba_exec)
os.chmod(nba_exec, 0o0775)

commandArray = [nba_exec, "--fullscreen", rom]
return Command.Command(
array=commandArray,
env={
'SDL_GAMECONTROLLERCONFIG': controllersConfig.generateSdlGameControllerConfig(playersControllers)
})
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
'configgen.generators.eduke32',
'configgen.generators.raze',
'configgen.generators.sh',
'configgen.generators.nba',
'configgen.settings',
'configgen.utils',
],
Expand Down
1 change: 1 addition & 0 deletions package/batocera/core/batocera-system/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ config BR2_PACKAGE_BATOCERA_HANDHELD_SYSTEMS
select BR2_PACKAGE_LIBRETRO_MGBA # ALL
select BR2_PACKAGE_LIBRETRO_VBA_M if !BR2_PACKAGE_BATOCERA_TARGET_RPI1 && !BR2_PACKAGE_BATOCERA_TARGET_CHA
select BR2_PACKAGE_LIBRETRO_GPSP if BR2_PACKAGE_BATOCERA_TARGET_RPI1 # for slow machines
select BR2_PACKAGE_NBA if BR2_PACKAGE_BATOCERA_TARGET_X86_64

# NDS
select BR2_PACKAGE_LIBRETRO_DESMUME if BR2_PACKAGE_BATOCERA_TARGET_X86_ANY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8959,3 +8959,8 @@ raze:
choices:
"Skip": 1
"Show": 0

nba:
features: [padtokeyboard]
shared: [videomode, bezel, bezel_stretch, hud, bezel.tattoo, bezel.tattoo_corner, bezel.tattoo_file, bezel.resize_tattoo]

Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ gba:
mgba: { requireAnyOf: [BR2_PACKAGE_LIBRETRO_MGBA] }
vba-m: { requireAnyOf: [BR2_PACKAGE_LIBRETRO_VBA_M] }
gpsp: { requireAnyOf: [BR2_PACKAGE_LIBRETRO_GPSP] }
nba:
nba: { requireAnyOf: [BR2_PACKAGE_NBA] }
comment_en: |
For more info: https://wiki.batocera.org/systems:gba
comment_fr: |
Expand Down
10 changes: 10 additions & 0 deletions package/batocera/emulators/nba/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
config BR2_PACKAGE_NBA
bool "nba"
depends on BR2_INSTALL_LIBSTDCPP
select BR2_PACKAGE_SDL2
select BR2_PACKAGE_LIBGLEW

help
A highly accurate Nintendo Game Boy Advance emulator.

https://github.com/nba-emu/NanoBoyAdvance
9 changes: 9 additions & 0 deletions package/batocera/emulators/nba/gba.nba.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"actions_player1": [
{
"trigger": ["hotkey", "start"],
"type": "key",
"target": [ "KEY_LEFTALT", "KEY_F4" ]
}
]
}
36 changes: 36 additions & 0 deletions package/batocera/emulators/nba/nba.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
################################################################################
#
# NanoBoyAdvance
#
################################################################################

NBA_VERSION = v1.4
NBA_SITE = https://github.com/nba-emu/NanoBoyAdvance.git
NBA_SITE_METHOD = git
NBA_GIT_SUBMODULES = YES
NBA_LICENSE = GPL v3
NBA_DEPENDENCIES = sdl2 libglew

NBA_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
NBA_CONF_OPTS += -DBUILD_SHARED_LIBS=ON
NBA_CONF_OPTS += -DBUILD_TESTS=OFF

define NBA_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/usr/nba
mkdir -p $(TARGET_DIR)/usr/lib

$(INSTALL) -D $(@D)/bin/sdl/NanoBoyAdvance \
$(TARGET_DIR)/usr/nba/NanoBoyAdvance
$(INSTALL) -D $(@D)/external/fmtlib/libfmt.so.6.1.3 \
$(TARGET_DIR)/usr/lib/libfmt.so.6.1.3

cp -pr $(@D)/external/fmtlib/libfmt.so.6 $(TARGET_DIR)/usr/lib/
cp -pr $(@D)/bin/sdl/shader $(TARGET_DIR)/usr/nba/
cp -pr $(@D)/bin/sdl/*.toml $(TARGET_DIR)/usr/nba/

# evmap config
mkdir -p $(TARGET_DIR)/usr/share/evmapy
cp $(BR2_EXTERNAL_BATOCERA_PATH)/package/batocera/emulators/nba/gba.nba.keys $(TARGET_DIR)/usr/share/evmapy
endef

$(eval $(cmake-package))