summaryrefslogtreecommitdiff
path: root/pcr/supermodel
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/supermodel')
-rw-r--r--pcr/supermodel/PKGBUILD38
-rw-r--r--pcr/supermodel/multiuser.patch107
-rw-r--r--pcr/supermodel/supermodel.install12
-rw-r--r--pcr/supermodel/supermodel.sh12
4 files changed, 169 insertions, 0 deletions
diff --git a/pcr/supermodel/PKGBUILD b/pcr/supermodel/PKGBUILD
new file mode 100644
index 000000000..677a7bb7c
--- /dev/null
+++ b/pcr/supermodel/PKGBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Anton Shestakov <engored*ya.ru>
+
+pkgname=supermodel
+pkgver=0.2a
+pkgrel=1
+pkgdesc='A Sega Model 3 Arcade Emulator'
+arch=('i686' 'x86_64')
+url='http://www.supermodel3.com/'
+license=('GPL3')
+depends=('mesa' 'sdl' 'zlib')
+install=supermodel.install
+source=('multiuser.patch' 'supermodel.sh'
+ "http://www.supermodel3.com/Files/Supermodel_${pkgver}_Src.zip")
+md5sums=('a7cf136e412a0d927b099c15793b658d' 'ea8274c2a37acddd026fce9c831530cc'
+ 'd7328d28adab21ed0896c2aae988d1d8')
+
+MAKEFLAGS="-j1"
+
+build() {
+ cd "$srcdir/Supermodel_${pkgver}_Src"
+ sed -e "s/-Wall -O3/$CFLAGS/" -i 'Makefiles/Makefile.SDL.UNIX.GCC'
+ patch -p1 < ../multiuser.patch
+ make -f 'Makefiles/Makefile.SDL.UNIX.GCC'
+}
+
+package() {
+ cd "$srcdir/Supermodel_${pkgver}_Src"
+
+ install -Dm755 "$srcdir/supermodel.sh" "$pkgdir/usr/bin/supermodel"
+
+ install -Dm755 "bin/Supermodel" "$pkgdir/usr/share/supermodel/Supermodel"
+
+ install -Dm644 "Docs/LICENSE.txt" "$pkgdir/usr/share/licenses/supermodel/LICENSE"
+ install -Dm644 "Docs/README.txt" "$pkgdir/usr/share/doc/supermodel/README"
+
+ install -d "$pkgdir/usr/share/supermodel/Config"
+ install -m644 Config/* "$pkgdir/usr/share/supermodel/Config/"
+}
diff --git a/pcr/supermodel/multiuser.patch b/pcr/supermodel/multiuser.patch
new file mode 100644
index 000000000..9cb93e02c
--- /dev/null
+++ b/pcr/supermodel/multiuser.patch
@@ -0,0 +1,107 @@
+diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp
+--- a/Src/OSD/SDL/Main.cpp
++++ b/Src/OSD/SDL/Main.cpp
+@@ -307,7 +307,6 @@
+ Configuration file management and input settings.
+ ******************************************************************************/
+
+-#define CONFIG_FILE_PATH "Config/Supermodel.ini"
+ #define CONFIG_FILE_COMMENT ";\n" \
+ "; Supermodel Configuration File\n" \
+ ";\n"
+@@ -315,9 +314,13 @@
+ // Create and configure inputs
+ static bool ConfigureInputs(CInputs *Inputs, bool configure)
+ {
++ char configFilePath[512];
++
++ sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
++
+ // Open and parse configuration file
+ CINIFile INI;
+- INI.Open(CONFIG_FILE_PATH); // doesn't matter if it exists or not, will get overwritten
++ INI.Open(configFilePath); // doesn't matter if it exists or not, will get overwritten
+ INI.SetDefaultSectionName("Global");
+ INI.Parse();
+
+@@ -338,9 +341,9 @@
+ Inputs->WriteToINIFile(&INI, "Global");
+
+ if (OKAY != INI.Write(CONFIG_FILE_COMMENT))
+- ErrorLog("Unable to save configuration to '%s'.", CONFIG_FILE_PATH);
++ ErrorLog("Unable to save configuration to '%s'.", configFilePath);
+ else
+- printf("Configuration successfully saved to '%s'.\n", CONFIG_FILE_PATH);
++ printf("Configuration successfully saved to '%s'.\n", configFilePath);
+ }
+ else
+ puts("Configuration aborted...");
+@@ -412,9 +415,13 @@
+ // Read settings (from a specific section) from the config file
+ static void ReadConfigFile(const char *section)
+ {
++ char configFilePath[512];
++
++ sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
++
+ CINIFile INI;
+
+- INI.Open(CONFIG_FILE_PATH);
++ INI.Open(configFilePath);
+ INI.SetDefaultSectionName("Global"); // required to read settings not associated with a specific section
+ INI.Parse();
+ ApplySettings(&INI, section);
+@@ -498,10 +505,10 @@
+ static void SaveState(CModel3 *Model3)
+ {
+ CBlockFile SaveState;
+- char filePath[24];
++ char filePath[512];
+ int fileVersion = STATE_FILE_VERSION;
+
+- sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
++ sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
+ if (OKAY != SaveState.Create(filePath, "Supermodel Save State", "Supermodel Version " SUPERMODEL_VERSION))
+ {
+ ErrorLog("Unable to save state to '%s'.", filePath);
+@@ -522,11 +529,11 @@
+ static void LoadState(CModel3 *Model3)
+ {
+ CBlockFile SaveState;
+- char filePath[24];
++ char filePath[512];
+ int fileVersion;
+
+ // Generate file path
+- sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
++ sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
+
+ // Open and check to make sure format is correct
+ if (OKAY != SaveState.Load(filePath))
+@@ -558,10 +565,10 @@
+ static void SaveNVRAM(CModel3 *Model3)
+ {
+ CBlockFile NVRAM;
+- char filePath[24];
++ char filePath[512];
+ int fileVersion = NVRAM_FILE_VERSION;
+
+- sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
++ sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
+ if (OKAY != NVRAM.Create(filePath, "Supermodel NVRAM State", "Supermodel Version " SUPERMODEL_VERSION))
+ {
+ ErrorLog("Unable to save NVRAM to '%s'. Make sure directory exists!", filePath);
+@@ -581,11 +588,11 @@
+ static void LoadNVRAM(CModel3 *Model3)
+ {
+ CBlockFile NVRAM;
+- char filePath[24];
++ char filePath[512];
+ int fileVersion;
+
+ // Generate file path
+- sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
++ sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
+
+ // Open and check to make sure format is correct
+ if (OKAY != NVRAM.Load(filePath))
diff --git a/pcr/supermodel/supermodel.install b/pcr/supermodel/supermodel.install
new file mode 100644
index 000000000..94ef82c48
--- /dev/null
+++ b/pcr/supermodel/supermodel.install
@@ -0,0 +1,12 @@
+# Message displayed for a fresh install.
+post_install() {
+ echo ""
+ echo "***************************************************************"
+ echo " Supermodel has been installed in /usr/share/supermodel."
+ echo " However, Supermodel can be run by typing supermodel and it's options:"
+ echo " supermodel <romset> [options]"
+ echo ""
+ echo " Note: You need to provide the full path to the romset."
+ echo "***************************************************************"
+ echo ""
+}
diff --git a/pcr/supermodel/supermodel.sh b/pcr/supermodel/supermodel.sh
new file mode 100644
index 000000000..992dd406d
--- /dev/null
+++ b/pcr/supermodel/supermodel.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+mkdir -p ~/.supermodel/NVRAM
+mkdir -p ~/.supermodel/saves
+
+cd /usr/share/supermodel
+
+if [[ ! -f ~/.supermodel/supermodel.ini ]]; then
+ cp ./Config/Supermodel.ini ~/.supermodel/supermodel.ini
+fi
+
+./Supermodel "$@"