[Scummvm-git-logs] scummvm master -> 8b071c96ccf988f711bb019e9f5d0380ba37c8de
zeldin-of-two-factors
80979729+zeldin-of-two-factors at users.noreply.github.com
Wed Nov 3 19:01:57 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
52cf32cccc DC: Break out some common code into a shared file
a8c59ef5b2 DC: Bump required libronin version
8b071c96cc DISTS: DC: Add a GD-ROM texture file
Commit: 52cf32cccc8945d4921d05f6c5fe3474f2c11be2
https://github.com/scummvm/scummvm/commit/52cf32cccc8945d4921d05f6c5fe3474f2c11be2
Author: Marcus Comstedt (marcus at mc.pp.se)
Date: 2021-11-03T19:10:25+01:00
Commit Message:
DC: Break out some common code into a shared file
Also, add some C++11 constructs for good measure. :-)
Changed paths:
A backends/platform/dc/dcutils.cpp
A backends/platform/dc/dcutils.h
backends/platform/dc/Makefile
backends/platform/dc/dcmain.cpp
backends/platform/dc/module.mk
backends/platform/dc/plugins.cpp
backends/platform/dc/selector.cpp
diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile
index e36823852c..50e17aa4da 100644
--- a/backends/platform/dc/Makefile
+++ b/backends/platform/dc/Makefile
@@ -66,7 +66,8 @@ ENABLE_TOUCHE = $(ENABLED)
ENABLE_TUCKER = $(ENABLED)
OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
- label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o
+ label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o \
+ dcutils.o
MODULE_DIRS += ./
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 885b53b0df..3b3436c46a 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -27,6 +27,7 @@
#include <base/main.h>
#include <base/plugins.h>
#include "dc.h"
+#include "dcutils.h"
#include "icon.h"
#include "DCLauncherDialog.h"
#include <common/config-manager.h>
@@ -139,7 +140,6 @@ bool DCCDManager::isPlaying() const {
if (DefaultAudioCDManager::isPlaying())
return true;
- extern int getCdState();
return getCdState() == 3;
}
@@ -247,78 +247,6 @@ void OSystem_Dreamcast::logMessage(LogMessageType::Type type, const char *messag
#endif
}
-namespace DC_Flash {
- static int syscall_info_flash(int sect, int *info)
- {
- return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
- }
-
- static int syscall_read_flash(int offs, void *buf, int cnt)
- {
- return (*(int (**)(int, void*, int, int))0x8c0000b8)(offs,buf,cnt,1);
- }
-
- static int flash_crc(const char *buf, int size)
- {
- int i, c, n = -1;
- for(i=0; i<size; i++) {
- n ^= (buf[i]<<8);
- for(c=0; c<8; c++)
- if(n & 0x8000)
- n = (n << 1) ^ 4129;
- else
- n <<= 1;
- }
- return (unsigned short)~n;
- }
-
- static int flash_read_sector(int partition, int sec, unsigned char *dst)
- {
- int s, r, n, b, bmb, got=0;
- int info[2];
- char buf[64];
- char bm[64];
-
- if((r = syscall_info_flash(partition, info))<0)
- return r;
-
- if((r = syscall_read_flash(info[0], buf, 64))<0)
- return r;
-
- if(memcmp(buf, "KATANA_FLASH", 12) ||
- buf[16] != partition || buf[17] != 0)
- return -2;
-
- n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15);
- bmb = n+1;
- for(b = 0; b < n; b++) {
- if(!(b&511)) {
- if((r = syscall_read_flash(info[0] + (bmb++ << 6), bm, 64))<0)
- return r;
- }
- if(!(bm[(b>>3)&63] & (0x80>>(b&7)))) {
- if((r = syscall_read_flash(info[0] + ((b+1) << 6), buf, 64))<0)
- return r;
- else if((s=READ_LE_UINT16(buf+0)) == sec &&
- flash_crc(buf, 62) == READ_LE_UINT16(buf+62)) {
- memcpy(dst+(s-sec)*60, buf+2, 60);
- got=1;
- }
- }
- }
- return got;
- }
-
- static int get_locale_setting()
- {
- unsigned char data[60];
- if (flash_read_sector(2,5,data) == 1)
- return data[5];
- else
- return -1;
- }
-} // End of namespace DC_Flash
-
Common::String OSystem_Dreamcast::getSystemLanguage() const {
static const char *languages[] = {
"ja_JP",
diff --git a/backends/platform/dc/dcutils.cpp b/backends/platform/dc/dcutils.cpp
new file mode 100644
index 0000000000..de2c568cd3
--- /dev/null
+++ b/backends/platform/dc/dcutils.cpp
@@ -0,0 +1,251 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_EXCEPTION_chdir
+
+#include "dc.h"
+#include "dcutils.h"
+#include <ronin/gddrive.h>
+
+
+int getCdState()
+{
+ unsigned int param[4];
+ gdGdcGetDrvStat(param);
+ return param[0];
+}
+
+extern "C" {
+ int dummy_cdfs_get_volume_id(char *, unsigned int) {
+ return -1;
+ }
+ int cdfs_get_volume_id(char *, unsigned int) __attribute__ ((weak, alias ("dummy_cdfs_get_volume_id")));
+}
+
+DiscLabel::DiscLabel() {
+ if (cdfs_get_volume_id(buf, 32) < 0)
+ memset(buf, '*', 32);
+}
+
+bool DiscLabel::operator==(const DiscLabel &other) const {
+ return !memcmp(buf, other.buf, 32);
+}
+
+void DiscLabel::get(char *p) const {
+ memcpy(p, buf, 32);
+ p[32] = 0;
+}
+
+
+void draw_solid_quad(float x1, float y1, float x2, float y2,
+ int c0, int c1, int c2, int c3)
+{
+ struct polygon_list mypoly;
+ struct packed_colour_vertex_list myvertex;
+
+ mypoly.cmd =
+ TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_OPAQUE|TA_CMD_POLYGON_SUBLIST|
+ TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|
+ TA_CMD_POLYGON_GOURAUD_SHADING;
+ mypoly.mode1 = TA_POLYMODE1_Z_ALWAYS|TA_POLYMODE1_NO_Z_UPDATE;
+ mypoly.mode2 =
+ TA_POLYMODE2_BLEND_SRC|TA_POLYMODE2_FOG_DISABLED;
+ mypoly.texture = 0;
+
+ mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
+
+ ta_commit_list(&mypoly);
+
+ myvertex.cmd = TA_CMD_VERTEX;
+ myvertex.ocolour = 0;
+ myvertex.z = 0.5;
+ myvertex.u = 0.0;
+ myvertex.v = 0.0;
+
+ myvertex.colour = c0;
+ myvertex.x = x1;
+ myvertex.y = y1;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c1;
+ myvertex.x = x2;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c2;
+ myvertex.x = x1;
+ myvertex.y = y2;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c3;
+ myvertex.x = x2;
+ myvertex.cmd |= TA_CMD_VERTEX_EOS;
+ ta_commit_list(&myvertex);
+}
+
+void draw_trans_quad(float x1, float y1, float x2, float y2,
+ int c0, int c1, int c2, int c3)
+{
+ struct polygon_list mypoly;
+ struct packed_colour_vertex_list myvertex;
+
+ mypoly.cmd =
+ TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST|
+ TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|
+ TA_CMD_POLYGON_GOURAUD_SHADING;
+ mypoly.mode1 = TA_POLYMODE1_Z_ALWAYS|TA_POLYMODE1_NO_Z_UPDATE;
+ mypoly.mode2 =
+ TA_POLYMODE2_BLEND_SRC_ALPHA|TA_POLYMODE2_BLEND_DST_INVALPHA|
+ TA_POLYMODE2_FOG_DISABLED|TA_POLYMODE2_ENABLE_ALPHA;
+ mypoly.texture = 0;
+
+ mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
+
+ ta_commit_list(&mypoly);
+
+ myvertex.cmd = TA_CMD_VERTEX;
+ myvertex.ocolour = 0;
+ myvertex.z = 0.5;
+ myvertex.u = 0.0;
+ myvertex.v = 0.0;
+
+ myvertex.colour = c0;
+ myvertex.x = x1;
+ myvertex.y = y1;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c1;
+ myvertex.x = x2;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c2;
+ myvertex.x = x1;
+ myvertex.y = y2;
+ ta_commit_list(&myvertex);
+
+ myvertex.colour = c3;
+ myvertex.x = x2;
+ myvertex.cmd |= TA_CMD_VERTEX_EOS;
+ ta_commit_list(&myvertex);
+}
+
+DiscSwap::DiscSwap(const char *label, unsigned int argb_) : argb(argb_) {
+ x = 320 - 7 * strlen(label);
+ lab.create_texture(label);
+}
+
+void DiscSwap::run()
+{
+ int wasopen = 0;
+ for (;;) {
+ int s = getCdState();
+ if (s >= 6)
+ wasopen = 1;
+ if (s > 0 && s < 6 && wasopen) {
+ cdfs_reinit();
+ chdir("/"); // Expect this one to fail with ERR_DISKCHG
+ chdir("/"); // but this one to succeed
+ return;
+ }
+
+ ta_begin_frame();
+ background();
+ ta_commit_end();
+ lab.draw(x, 200.0, argb);
+ ta_commit_frame();
+
+ interact();
+ }
+}
+
+namespace DC_Flash {
+
+ static int syscall_info_flash(int sect, int *info)
+ {
+ return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
+ }
+
+ static int syscall_read_flash(int offs, void *buf, int cnt)
+ {
+ return (*(int (**)(int, void*, int, int))0x8c0000b8)(offs,buf,cnt,1);
+ }
+
+ static int flash_crc(const char *buf, int size)
+ {
+ int i, c, n = -1;
+ for(i=0; i<size; i++) {
+ n ^= (buf[i]<<8);
+ for(c=0; c<8; c++)
+ if(n & 0x8000)
+ n = (n << 1) ^ 4129;
+ else
+ n <<= 1;
+ }
+ return (unsigned short)~n;
+ }
+
+ int flash_read_sector(int partition, int sec, unsigned char *dst)
+ {
+ int s, r, n, b, bmb, got=0;
+ int info[2];
+ char buf[64];
+ char bm[64];
+
+ if((r = syscall_info_flash(partition, info))<0)
+ return r;
+
+ if((r = syscall_read_flash(info[0], buf, 64))<0)
+ return r;
+
+ if(memcmp(buf, "KATANA_FLASH", 12) ||
+ buf[16] != partition || buf[17] != 0)
+ return -2;
+
+ n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15);
+ bmb = n+1;
+ for(b = 0; b < n; b++) {
+ if(!(b&511)) {
+ if((r = syscall_read_flash(info[0] + (bmb++ << 6), bm, 64))<0)
+ return r;
+ }
+ if(!(bm[(b>>3)&63] & (0x80>>(b&7)))) {
+ if((r = syscall_read_flash(info[0] + ((b+1) << 6), buf, 64))<0)
+ return r;
+ else if((s=READ_LE_UINT16(buf+0)) == sec &&
+ flash_crc(buf, 62) == READ_LE_UINT16(buf+62)) {
+ memcpy(dst+(s-sec)*60, buf+2, 60);
+ got=1;
+ }
+ }
+ }
+ return got;
+ }
+
+ int get_locale_setting()
+ {
+ unsigned char data[60];
+ if (flash_read_sector(2,5,data) == 1)
+ return data[5];
+ else
+ return -1;
+ }
+
+} // End of namespace DC_Flash
diff --git a/backends/platform/dc/dcutils.h b/backends/platform/dc/dcutils.h
new file mode 100644
index 0000000000..4c5245fac1
--- /dev/null
+++ b/backends/platform/dc/dcutils.h
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DC_DCUTILS_H
+#define DC_DCUTILS_H
+
+extern int getCdState();
+
+class TextureStack {
+private:
+ void *mark;
+public:
+ TextureStack() {
+ ta_sync();
+ mark = ta_txmark();
+ }
+ ~TextureStack() {
+ ta_sync();
+ ta_txrelease(mark);
+ }
+};
+
+class DiscLabel {
+private:
+ char buf[32];
+public:
+ DiscLabel();
+ bool operator==(const DiscLabel &other) const;
+ void get(char *p) const;
+};
+
+class DiscSwap : TextureStack {
+private:
+ unsigned int argb;
+ float x;
+ Label lab;
+protected:
+ virtual void background() {}
+ virtual void interact() {}
+public:
+ DiscSwap(const char *label, unsigned int argb);
+ virtual ~DiscSwap() {}
+ void run();
+};
+
+extern void draw_solid_quad(float x1, float y1, float x2, float y2,
+ int c0, int c1, int c2, int c3);
+extern void draw_trans_quad(float x1, float y1, float x2, float y2,
+ int c0, int c1, int c2, int c3);
+
+namespace DC_Flash {
+ int flash_read_sector(int partition, int sec, unsigned char *dst);
+ int get_locale_setting();
+} // End of namespace DC_Flash
+
+
+#endif /* DC_DCUTILS_H */
diff --git a/backends/platform/dc/module.mk b/backends/platform/dc/module.mk
index 9ab287c080..109ab2d6dd 100644
--- a/backends/platform/dc/module.mk
+++ b/backends/platform/dc/module.mk
@@ -1,7 +1,8 @@
MODULE := backends/platform/dc
MODULE_OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
- label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o
+ label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o \
+ dcutils.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/dc/plugins.cpp b/backends/platform/dc/plugins.cpp
index 3b4aff7f9f..c5d3ad32fb 100644
--- a/backends/platform/dc/plugins.cpp
+++ b/backends/platform/dc/plugins.cpp
@@ -30,14 +30,11 @@
#include "common/fs.h"
#include "dcloader.h"
-
-extern void draw_solid_quad(float x1, float y1, float x2, float y2,
- int c0, int c1, int c2, int c3);
+#include "dcutils.h"
static void drawPluginProgress(const Common::String &filename)
{
- ta_sync();
- void *mark = ta_txmark();
+ TextureStack txstack;
const char *fn = filename.c_str();
Label lab1, lab2, lab3;
char buf[32];
@@ -62,37 +59,8 @@ static void drawPluginProgress(const Common::String &filename)
lab2.draw(100.0, 190.0, 0xffaaffaa);
lab3.draw(100.0, 230.0, 0xffffffff);
ta_commit_frame();
- ta_sync();
- ta_txrelease(mark);
-}
-
-extern int getCdState();
-extern "C" {
- int dummy_cdfs_get_volume_id(char *, unsigned int) {
- return -1;
- }
- int cdfs_get_volume_id(char *, unsigned int) __attribute__ ((weak, alias ("dummy_cdfs_get_volume_id")));
}
-class DiscLabel {
-private:
- char buf[32];
-public:
- DiscLabel() {
- if (cdfs_get_volume_id(buf, 32) < 0)
- memset(buf, '*', 32);
- }
-
- bool operator==(const DiscLabel &other) const {
- return !memcmp(buf, other.buf, 32);
- }
-
- void get(char *p) const {
- memcpy(p, buf, 32);
- p[32] = 0;
- }
-};
-
class OSystem_Dreamcast::DCPlugin : public DynamicPlugin {
protected:
void *_dlHandle;
@@ -158,33 +126,11 @@ void OSystem_Dreamcast::DCPlugin::checkDisc(const DiscLabel &target)
if (current == target)
return;
- Label lab;
- int wasopen = 0;
- ta_sync();
- void *mark = ta_txmark();
char buf[32+24];
strcpy(buf, "Please insert disc '");
target.get(buf+strlen(buf));
strcat(buf, "'");
- lab.create_texture(buf);
- for (;;) {
- int s = getCdState();
- if (s >= 6)
- wasopen = 1;
- if (s > 0 && s < 6 && wasopen) {
- cdfs_reinit();
- chdir("/");
- chdir("/");
- ta_sync();
- ta_txrelease(mark);
- break;
- }
-
- ta_begin_frame();
- ta_commit_end();
- lab.draw(100.0, 200.0, 0xffffffff);
- ta_commit_frame();
- }
+ DiscSwap(buf, 0xffffffff).run();
}
}
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 7f03eaa687..8ec9926271 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -33,6 +33,7 @@
#include "dc.h"
#include "icon.h"
#include "label.h"
+#include "dcutils.h"
#include <ronin/gddrive.h>
@@ -42,98 +43,6 @@
#define MAX_PLUGIN_DIRS 100
-void draw_solid_quad(float x1, float y1, float x2, float y2,
- int c0, int c1, int c2, int c3)
-{
- struct polygon_list mypoly;
- struct packed_colour_vertex_list myvertex;
-
- mypoly.cmd =
- TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_OPAQUE|TA_CMD_POLYGON_SUBLIST|
- TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|
- TA_CMD_POLYGON_GOURAUD_SHADING;
- mypoly.mode1 = TA_POLYMODE1_Z_ALWAYS|TA_POLYMODE1_NO_Z_UPDATE;
- mypoly.mode2 =
- TA_POLYMODE2_BLEND_SRC|TA_POLYMODE2_FOG_DISABLED;
- mypoly.texture = 0;
-
- mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
-
- ta_commit_list(&mypoly);
-
- myvertex.cmd = TA_CMD_VERTEX;
- myvertex.ocolour = 0;
- myvertex.z = 0.5;
- myvertex.u = 0.0;
- myvertex.v = 0.0;
-
- myvertex.colour = c0;
- myvertex.x = x1;
- myvertex.y = y1;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c1;
- myvertex.x = x2;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c2;
- myvertex.x = x1;
- myvertex.y = y2;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c3;
- myvertex.x = x2;
- myvertex.cmd |= TA_CMD_VERTEX_EOS;
- ta_commit_list(&myvertex);
-}
-
-void draw_trans_quad(float x1, float y1, float x2, float y2,
- int c0, int c1, int c2, int c3)
-{
- struct polygon_list mypoly;
- struct packed_colour_vertex_list myvertex;
-
- mypoly.cmd =
- TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST|
- TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|
- TA_CMD_POLYGON_GOURAUD_SHADING;
- mypoly.mode1 = TA_POLYMODE1_Z_ALWAYS|TA_POLYMODE1_NO_Z_UPDATE;
- mypoly.mode2 =
- TA_POLYMODE2_BLEND_SRC_ALPHA|TA_POLYMODE2_BLEND_DST_INVALPHA|
- TA_POLYMODE2_FOG_DISABLED|TA_POLYMODE2_ENABLE_ALPHA;
- mypoly.texture = 0;
-
- mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
-
- ta_commit_list(&mypoly);
-
- myvertex.cmd = TA_CMD_VERTEX;
- myvertex.ocolour = 0;
- myvertex.z = 0.5;
- myvertex.u = 0.0;
- myvertex.v = 0.0;
-
- myvertex.colour = c0;
- myvertex.x = x1;
- myvertex.y = y1;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c1;
- myvertex.x = x2;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c2;
- myvertex.x = x1;
- myvertex.y = y2;
- ta_commit_list(&myvertex);
-
- myvertex.colour = c3;
- myvertex.x = x2;
- myvertex.cmd |= TA_CMD_VERTEX_EOS;
- ta_commit_list(&myvertex);
-}
-
-
struct Game
{
char dir[256];
@@ -317,50 +226,20 @@ static int findGames(Game *games, int max, bool use_ini)
return curr_game;
}
-int getCdState()
-{
- unsigned int param[4];
- gdGdcGetDrvStat(param);
- return param[0];
-}
-
static void drawBackground()
{
draw_solid_quad(20.0, 20.0, 620.0, 460.0,
0xff0000, 0x00ff00, 0x0000ff, 0xffffff);
}
-void waitForDisk()
-{
- Label lab;
- int wasopen = 0;
- ta_sync();
- void *mark = ta_txmark();
- lab.create_texture("Please insert game CD.");
- //printf("waitForDisk, cdstate = %d\n", getCdState());
- for (;;) {
- int s = getCdState();
- if (s >= 6)
- wasopen = 1;
- if (s > 0 && s < 6 && wasopen) {
- cdfs_reinit();
- chdir("/");
- chdir("/");
- ta_sync();
- ta_txrelease(mark);
- return;
- }
-
- ta_begin_frame();
-
+namespace {
+ class SelectorDiscSwap : public DiscSwap {
+ using DiscSwap::DiscSwap;
+ protected:
+ virtual void background() override {
drawBackground();
-
- ta_commit_end();
-
- lab.draw(166.0, 200.0, 0xffff2020);
-
- ta_commit_frame();
-
+ }
+ virtual void interact() override {
int mousex = 0, mousey = 0;
byte shiftFlags;
@@ -368,7 +247,14 @@ void waitForDisk()
setimask(15);
handleInput(locked_get_pads(), mousex, mousey, shiftFlags);
setimask(mask);
- }
+ }
+ };
+}
+
+void waitForDisk()
+{
+ //printf("waitForDisk, cdstate = %d\n", getCdState());
+ SelectorDiscSwap("Please insert game CD.", 0xffff2020).run();
}
static void drawGameLabel(Game &game, int pal, float x, float y,
@@ -478,29 +364,26 @@ bool selectGame(char *&engineId, char *&ret, char *&dir_ret, Common::Language &l
Game *games = new Game[MAX_GAMES];
int selected, num_games;
- ta_sync();
- void *mark = ta_txmark();
-
for (;;) {
num_games = findGames(games, MAX_GAMES, true);
if (!num_games)
num_games = findGames(games, MAX_GAMES, false);
- for (int i=0; i<num_games; i++) {
- games[i].icon.create_texture();
- games[i].label.create_texture(games[i].text);
- }
+ {
+ TextureStack txstack;
- selected = gameMenu(games, num_games);
+ for (int i=0; i<num_games; i++) {
+ games[i].icon.create_texture();
+ games[i].label.create_texture(games[i].text);
+ }
- ta_sync();
- ta_txrelease(mark);
+ selected = gameMenu(games, num_games);
+ }
if (selected == -1)
waitForDisk();
else
break;
-
}
if (selected >= num_games)
@@ -553,20 +436,18 @@ bool selectPluginDir(Common::String &selection, const Common::FSNode &base)
Game *plugin_dirs = new Game[MAX_PLUGIN_DIRS];
int selected, num_plugin_dirs;
- ta_sync();
- void *mark = ta_txmark();
-
num_plugin_dirs = findPluginDirs(plugin_dirs, MAX_PLUGIN_DIRS, base);
- for (int i=0; i<num_plugin_dirs; i++) {
+ {
+ TextureStack txstack;
+
+ for (int i=0; i<num_plugin_dirs; i++) {
plugin_dirs[i].icon.create_texture();
plugin_dirs[i].label.create_texture(plugin_dirs[i].text);
- }
+ }
- selected = gameMenu(plugin_dirs, num_plugin_dirs);
-
- ta_sync();
- ta_txrelease(mark);
+ selected = gameMenu(plugin_dirs, num_plugin_dirs);
+ }
if (selected >= num_plugin_dirs)
selected = -1;
Commit: a8c59ef5b2391836a6d0e954355bac0d023dd098
https://github.com/scummvm/scummvm/commit/a8c59ef5b2391836a6d0e954355bac0d023dd098
Author: Marcus Comstedt (marcus at mc.pp.se)
Date: 2021-11-03T19:10:25+01:00
Commit Message:
DC: Bump required libronin version
Changed paths:
backends/platform/dc/README
diff --git a/backends/platform/dc/README b/backends/platform/dc/README
index 3524f57bac..e6a4daa246 100644
--- a/backends/platform/dc/README
+++ b/backends/platform/dc/README
@@ -10,7 +10,7 @@ you'll need the following:
* newlib for sh-elf : <URL:http://mc.pp.se/dc/files/newlib-1.19.0.tar.gz>
-* libronin-0.6 : <URL:http://peter.bortas.org/scumm/libronin-0.6.tar.gz>
+* libronin-0.7 : <URL:http://peter.bortas.org/scumm/libronin-0.7.tar.gz>
* libmad : <URL:http://mc.pp.se/dc/files/libmad-0.15.1b.tar.gz>
Commit: 8b071c96ccf988f711bb019e9f5d0380ba37c8de
https://github.com/scummvm/scummvm/commit/8b071c96ccf988f711bb019e9f5d0380ba37c8de
Author: Marcus Comstedt (marcus at mc.pp.se)
Date: 2021-11-03T19:10:25+01:00
Commit Message:
DISTS: DC: Add a GD-ROM texture file
Changed paths:
A dists/dc/0GDTEX.PVR
diff --git a/dists/dc/0GDTEX.PVR b/dists/dc/0GDTEX.PVR
new file mode 100644
index 0000000000..eb8c8a395c
Binary files /dev/null and b/dists/dc/0GDTEX.PVR differ
More information about the Scummvm-git-logs
mailing list