Skip to content

Commit 897d435

Browse files
committed
More DOS updates:
- adjust log name (logging works without timestamp) - customize config name and provide config directory - move keyboard input handling to regular input driver - remove hardcoded joypad keys (RA defaults work fine) - extend keyboard map - adjust RGUI for a better default layout - add salamander build, not yet activated in CI
1 parent 9d8a49d commit 897d435

File tree

12 files changed

+570
-270
lines changed

12 files changed

+570
-270
lines changed

.gitlab-ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,19 @@ build-static-retroarch-djgpp:
899899
- "cp -r ./* .retroarch-precompiled/"
900900
- "mv .retroarch-precompiled/ retroarch-precompiled/"
901901

902+
#build-static-retroarch-dummy-djgpp:
903+
# image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-djgpp-build-container:latest
904+
# stage: build
905+
# before_script:
906+
# - export NUMPROC=$(($(nproc)/3))
907+
# artifacts:
908+
# paths:
909+
# - retrodos.exe
910+
# expire_in: 10 min
911+
# dependencies: []
912+
# script:
913+
# - "make -f Makefile.dos.salamander -j$NUMPROC release"
914+
902915
build-static-retroarch-ctr:
903916
image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-devkitpro:latest
904917
stage: prepare-for-static-cores

Makefile.dos.salamander

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
include version.all
2+
3+
#---------------------------------------------------------------------------------
4+
.SUFFIXES:
5+
#---------------------------------------------------------------------------------
6+
7+
TOPDIR ?= $(CURDIR)
8+
9+
10+
DEBUG ?= 0
11+
WHOLE_ARCHIVE_LINK = 0
12+
HAVE_STATIC_DUMMY ?= 0
13+
GRIFFIN_BUILD = 0
14+
15+
OBJ :=
16+
17+
DEFINES := -DHAVE_DJGPP=1 -U__linux__ -U__linux -DRARCH_INTERNAL -DHAVE_STB_VORBIS -DIS_SALAMANDER
18+
CC := i586-pc-msdosdjgpp-gcc
19+
CXX := i586-pc-msdosdjgpp-g++
20+
TARGET := retrodos.exe
21+
22+
RARCH_CONSOLE = 0
23+
HAVE_SHADERPIPELINE = 0
24+
HAVE_SPIRV_CROSS = 0
25+
HAVE_PATCH = 1
26+
HAVE_LUA = 0
27+
HAVE_CONFIGFILE = 1
28+
HAVE_GFX_WIDGETS = 0
29+
HAVE_LANGEXTRA = 1
30+
HAVE_DR_MP3 = 1
31+
HAVE_TRANSLATE = 0
32+
HAVE_SCREENSHOTS = 1
33+
HAVE_REWIND = 1
34+
HAVE_AUDIOMIXER = 1
35+
HAVE_CC_RESAMPLER = 1
36+
HAVE_MENU_COMMON = 1
37+
HAVE_RTGA = 1
38+
HAVE_RPNG = 1
39+
HAVE_RJPEG = 1
40+
HAVE_RBMP = 1
41+
HAVE_7ZIP = 1
42+
HAVE_ZLIB = 1
43+
HAVE_IMAGEVIEWER = 1
44+
HAVE_BUILTINZLIB = 1
45+
HAVE_LIBRETRODB = 0
46+
HAVE_DSP_FILTER = 1
47+
HAVE_VIDEO_FILTER = 1
48+
HAVE_STATIC_VIDEO_FILTERS = 1
49+
HAVE_STATIC_AUDIO_FILTERS = 1
50+
HAVE_STATIC_CORES = 1
51+
HAVE_FILTERS_BUILTIN = 1
52+
HAVE_MENU = 1
53+
HAVE_CONFIGFILE = 1
54+
HAVE_PATCH = 1
55+
HAVE_CHEATS = 1
56+
HAVE_RUNAHEAD = 1
57+
HAVE_NETWORKING = 0
58+
HAVE_IFINFO = 0
59+
HAVE_NETPLAYDISCOVERY = 0
60+
HAVE_OVERLAY := 1
61+
HAVE_STB_FONT = 1
62+
HAVE_COMMAND := 1
63+
HAVE_STDIN_CMD := 1
64+
HAVE_CMD := 1
65+
HAVE_CHEEVOS = 0
66+
HAVE_CHD = 1
67+
HAVE_STB_VORBIS = 1
68+
HAVE_IBXM = 1
69+
HAVE_CORE_INFO_CACHE = 1
70+
HAVE_XDELTA = 0 # disabled because <lzma.h> isn't available (or we haven't figured out how to install it)
71+
72+
HAVE_RGUI = 1
73+
HAVE_MATERIALUI = 0
74+
HAVE_XMB = 0
75+
HAVE_OZONE = 0
76+
77+
78+
OBJ := frontend/frontend_salamander.o \
79+
frontend/frontend_driver.o \
80+
frontend/drivers/platform_dos.o \
81+
libretro-common/file/file_path.o \
82+
libretro-common/file/file_path_io.o \
83+
libretro-common/string/stdstring.o \
84+
libretro-common/lists/string_list.o \
85+
libretro-common/lists/dir_list.o \
86+
libretro-common/file/retro_dirent.o \
87+
libretro-common/encodings/encoding_utf.o \
88+
libretro-common/compat/fopen_utf8.o \
89+
libretro-common/compat/compat_strl.o \
90+
libretro-common/compat/compat_strldup.o \
91+
libretro-common/compat/compat_strcasestr.o \
92+
libretro-common/file/config_file.o \
93+
libretro-common/streams/file_stream.o \
94+
libretro-common/vfs/vfs_implementation.o \
95+
libretro-common/hash/lrc_hash.o \
96+
libretro-common/time/rtime.o \
97+
verbosity.o
98+
99+
INCLUDE_DIRS = -Ilibretro-common/include
100+
101+
#---------------------------------------------------------------------------------
102+
# TARGET is the name of the output
103+
# BUILD is the directory where object files & intermediate files will be placed
104+
# SOURCES is a list of directories containing source code
105+
# DATA is a list of directories containing data files
106+
# INCLUDES is a list of directories containing header files
107+
# EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm".
108+
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
109+
#
110+
# NO_ICON: if set to anything, do not use icon.
111+
# NO_NACP: if set to anything, no .nacp file is generated.
112+
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
113+
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
114+
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
115+
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
116+
# ICON is the filename of the icon (.jpg), relative to the project folder.
117+
# If not set, it attempts to use one of the following (in this order):
118+
# - <Project name>.jpg
119+
# - icon.jpg
120+
# - <libnx folder>/default_icon.jpg
121+
#---------------------------------------------------------------------------------
122+
BUILD := build
123+
SOURCES := $(CURDIR)/source
124+
DATA := data
125+
INCLUDES := include
126+
EXEFS_SRC := exefs_src
127+
128+
APP_TITLE := RetroArch
129+
APP_VERSION := $(RARCH_VERSION)
130+
APP_AUTHOR := libretro Team
131+
APP_ICON := pkg/libnx/retroarch.jpg
132+
133+
#---------------------------------------------------------------------------------
134+
# options for code generation
135+
#---------------------------------------------------------------------------------
136+
ARCH :=
137+
138+
CFLAGS := -g -Wall -O3 -fcommon -ffunction-sections \
139+
$(ARCH) $(DEFINES) $(INCLUDE_DIRS)
140+
141+
CFLAGS += $(INCLUDE)
142+
143+
ifeq ($(HAVE_FILTERS_BUILTIN), 1)
144+
CFLAGS += -DHAVE_FILTERS_BUILTIN
145+
endif
146+
147+
ifeq ($(strip $(HAVE_STATIC_DUMMY)),1)
148+
CFLAGS += -DHAVE_STATIC_DUMMY=1
149+
endif
150+
151+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
152+
153+
ASFLAGS := -g $(ARCH)
154+
LDFLAGS = $(ARCH) -Wl,--allow-multiple-definition -Wl,-Map,$(notdir $*.map)
155+
156+
# add things from Makefile.common
157+
CFLAGS += $(DEF_FLAGS)
158+
159+
LIBS := -lstdc++ -lm
160+
161+
#---------------------------------------------------------------------------------
162+
# no real need to edit anything past this point unless you need to add additional
163+
# rules for different file extensions
164+
#---------------------------------------------------------------------------------
165+
ifneq ($(BUILD),$(notdir $(CURDIR)))
166+
#---------------------------------------------------------------------------------
167+
168+
export OUTPUT := $(TARGET)
169+
export TOPDIR := $(CURDIR)
170+
171+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
172+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
173+
174+
export DEPSDIR := $(CURDIR)/
175+
176+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
177+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
178+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
179+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
180+
181+
export OFILES := $(OBJ)
182+
183+
ifeq ($(strip $(HAVE_STATIC_DUMMY)),)
184+
OFILES += libretro_libnx.a
185+
endif
186+
187+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
188+
189+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
190+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
191+
-I$(CURDIR)/$(BUILD)
192+
193+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
194+
195+
export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
196+
197+
ifneq ($(APP_TITLEID),)
198+
export NACPFLAGS += --titleid=$(APP_TITLEID)
199+
endif
200+
201+
ifneq ($(ROMFS),)
202+
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
203+
endif
204+
205+
LIB_CORE :=
206+
207+
ifeq ($(HAVE_STATIC_DUMMY),1)
208+
DEFINES += -DHAVE_STATIC_DUMMY
209+
else
210+
LIB_CORE += -lretro_dos
211+
endif
212+
213+
ifneq ($(V),1)
214+
Q := @
215+
endif
216+
217+
DEPENDS_TMP := $(OFILES:.o=.d)
218+
DEPENDS := $(filter-out libretro_libnx.a,$(DEPENDS_TMP))
219+
220+
.PHONY: clean all
221+
222+
#---------------------------------------------------------------------------------
223+
# main targets
224+
#---------------------------------------------------------------------------------
225+
all: $(OUTPUT)
226+
227+
define INFO
228+
CC: $(CC)
229+
CFLAGS: $(CFLAGS)
230+
CXX: $(CXX)
231+
DEPENDS: $(DEPENDS)
232+
LDFLAGS: $(LDFLAGS)
233+
LIBDIRS: $(LIBDIRS)
234+
LIBS: $(LIBS)
235+
LIB_CORE: $(LIB_CORE)
236+
OBJ: $(OBJ)
237+
OUTPUT: $(OUTPUT)
238+
PLATEXTRA: $(PLATEXTRA)
239+
endef
240+
export INFO
241+
242+
info:
243+
ifneq ($(V),1)
244+
@echo "$$INFO"
245+
endif
246+
247+
$(OUTPUT): $(OBJ)
248+
@$(if $(Q), $(shell echo echo CXX $<),)
249+
$(Q)$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(PLATEXTRA) -L. $(LIB_CORE) $(LIBS)
250+
251+
%.o: %.c
252+
@$(if $(Q), $(shell echo echo CC $<),)
253+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
254+
255+
%.o: %.cpp
256+
@$(if $(Q), $(shell echo echo CXX $<),)
257+
$(Q)$(CXX) -c -o $@ $(CFLAGS) $<
258+
259+
clean:
260+
@$(if $(Q), $(shell echo echo RM),)
261+
$(Q)rm -f $(DEPENDS) $(OBJ) $(OUTPUT)
262+
263+
#---------------------------------------------------------------------------------
264+
# you need a rule like this for each extension you use as binary data
265+
#---------------------------------------------------------------------------------
266+
%.bin.o %_bin.h : %.bin
267+
#---------------------------------------------------------------------------------
268+
@echo $(notdir $<)
269+
@$(bin2o)
270+
271+
#---------------------------------------------------------------------------------------
272+
endif
273+
#---------------------------------------------------------------------------------------

file_path_special.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ RETRO_BEGIN_DECLS
105105
#define FILE_PATH_BACKGROUND_IMAGE "bg.png"
106106
#define FILE_PATH_TTF_FONT "font.ttf"
107107
#define FILE_PATH_RUNTIME_EXTENSION ".lrtl"
108+
#ifdef DJGPP
109+
#define FILE_PATH_DEFAULT_EVENT_LOG "retrodos.log"
110+
#else
108111
#define FILE_PATH_DEFAULT_EVENT_LOG "retroarch.log"
112+
#endif
109113
#define FILE_PATH_EVENT_LOG_EXTENSION ".log"
110114
#define FILE_PATH_DISK_CONTROL_INDEX_EXTENSION ".ldci"
111115
#define FILE_PATH_CORE_BACKUP_EXTENSION ".lcbk"

frontend/drivers/platform_dos.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "../../command.h"
2727
#include "../../defaults.h"
2828
#include "../../paths.h"
29+
#include "../../file_path_special.h"
2930
#include "../../verbosity.h"
3031

3132
static enum frontend_fork dos_fork_mode = FRONTEND_FORK_NONE;
@@ -52,8 +53,6 @@ static void frontend_dos_get_env_settings(int *argc, char *argv[],
5253
char *slash;
5354
char base_path[PATH_MAX];
5455

55-
retro_main_log_file_init("retrodos.txt", false);
56-
5756
strlcpy(base_path, argv[0], sizeof(base_path));
5857
if ((slash = strrchr(base_path, '/')))
5958
*slash = '\0';
@@ -73,6 +72,8 @@ static void frontend_dos_get_env_settings(int *argc, char *argv[],
7372

7473
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], base_path,
7574
"config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
75+
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
76+
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
7677
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
7778
g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
7879
"remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
@@ -106,11 +107,21 @@ static void frontend_dos_get_env_settings(int *argc, char *argv[],
106107

107108
static void frontend_dos_exec(const char *path, bool should_load_game)
108109
{
109-
char *newargv[] = { NULL, NULL };
110-
size_t _len = strlen(path);
110+
char *newargv[] = { NULL, NULL, NULL };
111+
size_t _len = strlen(path) + 1;
111112

112-
newargv[0] = (char*)malloc(_len);
113+
#ifndef IS_SALAMANDER
114+
char game_path[FILENAME_MAX];
115+
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
116+
{
117+
const char *content = path_get(RARCH_PATH_CONTENT);
118+
strlcpy(game_path, content, sizeof(game_path));
119+
newargv[1] = game_path;
120+
printf("Attempt to load executable: [%s], with game [%s]\n", path, game_path);
121+
}
122+
#endif
113123

124+
newargv[0] = (char*)malloc(_len);
114125
strlcpy(newargv[0], path, _len);
115126

116127
execv(path, newargv);
@@ -120,11 +131,12 @@ static void frontend_dos_exitspawn(char *s, size_t len, char *args)
120131
{
121132
bool should_load_content = false;
122133

134+
#ifndef IS_SALAMANDER
123135
if (dos_fork_mode == FRONTEND_FORK_NONE)
124136
return;
125137
if (dos_fork_mode == FRONTEND_FORK_CORE_WITH_ARGS)
126138
should_load_content = true;
127-
139+
#endif
128140
frontend_dos_exec(s, should_load_content);
129141
}
130142

@@ -140,14 +152,15 @@ static bool frontend_dos_set_fork(enum frontend_fork fork_mode)
140152
break;
141153
case FRONTEND_FORK_RESTART:
142154
dos_fork_mode = FRONTEND_FORK_CORE;
143-
155+
#ifndef IS_SALAMANDER
144156
{
145157
char executable_path[PATH_MAX_LENGTH] = {0};
146158
fill_pathname_application_path(executable_path,
147159
sizeof(executable_path));
148160
path_set(RARCH_PATH_CORE, executable_path);
149161
}
150162
command_event(CMD_EVENT_QUIT, NULL);
163+
#endif
151164
break;
152165
case FRONTEND_FORK_NONE:
153166
default:

0 commit comments

Comments
 (0)