First pass at porting R77-specific changes to mainline.

- more work is required here, since I'm unable to test on a real R77 yet
- changes will also be required in the manually generated config.mak
This commit is contained in:
Stephen Anthony 2019-03-09 12:22:33 -03:30
parent 9b6cae5684
commit f508ca2634
7 changed files with 271 additions and 11 deletions

23
configure vendored
View File

@ -297,10 +297,8 @@ case $_host in
# _host_os=amigaos
# _host_cpu=ppc
# ;;
gp2x)
_host_os=gp2x
_host_cpu=arm
_host_prefix=arm-open2x-linux
retron77)
_host_os=retron77
;;
mingw32-cross)
_host_os=mingw32msvc
@ -357,7 +355,7 @@ if test -n "$CXX"; then
echo $CXX
else
if test -n "$_host"; then
compilers="$_host_prefix-g++ $_host_prefix-c++ $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++"
compilers="$_host_prefix-g++ $_host_prefix-c++ $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++ g++ c++"
else
compilers="g++ c++"
fi
@ -514,6 +512,12 @@ fi
if test -n "$_host"; then
# Cross-compiling mode - add your target here if needed
case "$_host" in
retron77)
echo "Compiling for $_host, disabling windowed mode, debugger and cheats."
_build_windowed=no
_build_debugger=no
_build_cheats=no
;;
mingw32-cross)
echo "Cross-compiling for Windows using MinGW."
DEFINES="$DEFINES -DWIN32"
@ -550,6 +554,10 @@ else
DEFINES="$DEFINES -DWIN32"
_host_os=win32
;;
os2*)
DEFINES="$DEFINES -DUNIX -DOS2"
_host_os=unix
;;
cygwin*)
DEFINES="$DEFINES -mno-cygwin -DWIN32"
LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
@ -734,6 +742,11 @@ case $_host_os in
MODULES="$MODULES $SRC/unix"
INCLUDES="$INCLUDES -I$SRC/unix"
;;
retron77)
DEFINES="$DEFINES -DBSPF_UNIX -DRETRON77"
MODULES="$MODULES $SRC/unix $SRC/unix/r77"
INCLUDES="$INCLUDES -I$SRC/unix -I$SRC/unix/r77"
;;
win32)
DEFINES="$DEFINES -DBSPF_WINDOWS"
MODULES="$MODULES $SRC/windows"

View File

@ -26,8 +26,13 @@
#include "SerialPort.hxx"
#if defined(BSPF_UNIX)
#include "SerialPortUNIX.hxx"
#if defined(RETRON77)
#include "SettingsR77.hxx"
#include "OSystemR77.hxx"
#else
#include "SettingsUNIX.hxx"
#include "OSystemUNIX.hxx"
#endif
#elif defined(BSPF_WINDOWS)
#include "SerialPortWINDOWS.hxx"
#include "SettingsWINDOWS.hxx"
@ -70,7 +75,11 @@ class MediaFactory
static unique_ptr<OSystem> createOSystem()
{
#if defined(BSPF_UNIX)
#if defined(RETRON77)
return make_unique<OSystemR77>();
#else
return make_unique<OSystemUNIX>();
#endif
#elif defined(BSPF_WINDOWS)
return make_unique<OSystemWINDOWS>();
#elif defined(BSPF_MACOS)
@ -83,7 +92,11 @@ class MediaFactory
static unique_ptr<Settings> createSettings()
{
#if defined(BSPF_UNIX)
#if defined(RETRON77)
return make_unique<SettingsR77>();
#else
return make_unique<SettingsUNIX>();
#endif
#elif defined(BSPF_WINDOWS)
return make_unique<SettingsWINDOWS>();
#elif defined(BSPF_MACOS)

View File

@ -0,0 +1,26 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystemR77.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemR77::getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir, bool, const string&)
{
basedir = savedir = loaddir = "/mnt/stella";
cfgfile = "/mnt/stella/stellarc";
}

View File

@ -0,0 +1,67 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef OSYSTEM_R77_HXX
#define OSYSTEM_R77_HXX
#include "OSystem.hxx"
/**
This class defines an OSystem object for the Retron77 system.
The Retron77 system is based on an embedded Linux platform.
It is responsible for completely implementing getBaseDirAndConfig(),
to set the base directory, config file location, and various other
save/load locations.
@author Stephen Anthony
*/
class OSystemR77 : public OSystem
{
public:
OSystemR77() = default;
virtual ~OSystemR77() = default;
/**
Determine the base directory and main configuration file from the
derived class. It can also use hints, as described below.
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
@param savedir The default directory to save various other files
@param loaddir The default directory to load various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@param usedir A hint that the base dir should be set to this
parameter; not all ports can do this, so
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir,
bool useappdir, const string& usedir) override;
private:
// Following constructors and assignment operators not supported
OSystemR77(const OSystemR77&) = delete;
OSystemR77(OSystemR77&&) = delete;
OSystemR77& operator=(const OSystemR77&) = delete;
OSystemR77& operator=(OSystemR77&&) = delete;
};
#endif

View File

@ -0,0 +1,81 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include <unistd.h>
#include "SettingsR77.hxx"
/**
The Retron77 system is a locked-down, set piece of hardware.
No configuration of Stella is possible, since the UI isn't exposed.
So we hardcode the specific settings here.
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsR77::SettingsR77()
: Settings()
{
setPermanent("video", "opengles2");
setPermanent("vsync", "true");
setPermanent("tia.zoom", "3");
// TODO - use new argument that differentiates between fullscreen and
// fullscreen without aspect correction
// Re-add ability to use a specific fullscreen resolution
setPermanent("fullscreen", "false"); // start in 16:9 mode by default
setPermanent("fullres", "1280x720");
setPermanent("romdir", "/mnt/games");
setPermanent("snapsavedir", "/mnt/stella/snapshots");
setPermanent("snaploaddir", "/mnt/stella/snapshots");
setPermanent("launcherres", "1280x720");
setPermanent("launcherfont", "large");
setPermanent("romviewer", "2");
setPermanent("exitlauncher", "true");
setPermanent("dev.settings", "false");
setPermanent("plr.timemachine", false);
// FIXME - these are out of date, since the # of events has changed since 3.x
setPermanent("keymap", "116:40:0:0:0:0:0:0:0:98:95:0:0:0:15:0:0:0:0:0:94:0:0:0:0:0:0:0:99:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:62:0:63:64:55:41:42:43:16:17:23:24:53:54:0:61:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:96:0:0:0:97:47:0:52:49:46:22:20:19:56:21:59:60:0:0:57:58:44:0:48:0:0:0:45:51:18:50:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:11:12:14:13:0:0:0:0:0:9:10:3:4:5:6:7:8:91:89:90:92:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:115:0:0:0:0:110:0:0:0:0:0:0:0:0:0:0:0:0:0:114:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:102:103:109:108:0:106:107:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0");
setPermanent("joymap", "116^i2c_controller|2 27 27 31 31 0 0 0 0|8 28 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0^i2c_controller 2|2 35 35 39 39 0 0 0 0|8 36 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SettingsR77::saveConfigFile(const string& cfgfile) const
{
// Almost no settings can be changed, so we completely disable saving
// most of them. This may also fix reported issues of the config file
// becoming corrupt.
//
// There is currently only one setting that can be changed - 'fullscreen'
// It determines whether to use 4:3 or 16:9 mode
ofstream out(cfgfile);
if(!out || !out.is_open())
return false;
out << "fullscreen = " << getString("fullscreen") << endl;
out.flush();
out.close();
// FIXME system("/bin/fsync /mnt/stella/stellarc&");
return true;
}

View File

@ -0,0 +1,49 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef SETTINGS_R77_HXX
#define SETTINGS_R77_HXX
#include "Settings.hxx"
/**
This class is used for the Retron77 system specific settings.
The Retron77 system is based on an embedded Linux platform.
@author Stephen Anthony
*/
class SettingsR77 : public Settings
{
public:
/**
Create a new UNIX settings object
*/
explicit SettingsR77();
virtual ~SettingsR77() = default;
protected:
bool saveConfigFile(const string& cfgfile) const;
private:
// Following constructors and assignment operators not supported
SettingsR77(const SettingsR77&) = delete;
SettingsR77(SettingsR77&&) = delete;
SettingsR77& operator=(const SettingsR77&) = delete;
SettingsR77& operator=(SettingsR77&&) = delete;
};
#endif

11
src/unix/r77/module.mk Normal file
View File

@ -0,0 +1,11 @@
MODULE := src/unix/r77
MODULE_OBJS := \
src/unix/r77/OSystemR77.o \
src/unix/r77/SettingsR77.o
MODULE_DIRS += \
src/unix/r77
# Include common rules
include $(srcdir)/common.rules