Skip to content

Commit ab31fb1

Browse files
committed
win compilation, interlace hack
1 parent c48d9e4 commit ab31fb1

File tree

4 files changed

+58
-11
lines changed

4 files changed

+58
-11
lines changed

src/libretro/Makefile.common

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ SOURCES_CPP := \
3737
$(CORE_DIR)/beeb/src/VideoULA.cpp \
3838
$(CORE_DIR)/shared/c/log.cpp \
3939
$(CORE_DIR)/shared/c/system.cpp \
40-
$(CORE_DIR)/shared/c/system_linux.cpp \
4140
$(CORE_DIR)/shared/c/mutex.cpp \
4241
$(CORE_DIR)/shared/c/CommandLineParser.cpp \
4342
$(CORE_DIR)/b2/BeebConfig.cpp \
@@ -55,9 +54,29 @@ SOURCES_CPP := \
5554

5655
SOURCES_C := \
5756
$(CORE_DIR)/6502/c/6502.c \
58-
$(CORE_DIR)/shared/c/system_posix.c \
5957
$(CORE_DIR)/shared/c/path.c \
60-
58+
59+
60+
ifneq (,$(findstring osx,$(platform)))
61+
SOURCES_CPP += \
62+
$(CORE_DIR)/shared/c/system_osx.cpp \
63+
64+
SOURCES_C += \
65+
$(CORE_DIR)/shared/c/system_posix.c \
66+
67+
else ifneq (,$(findstring unix,$(platform)))
68+
SOURCES_CPP += \
69+
$(CORE_DIR)/shared/c/system_linux.cpp \
70+
71+
SOURCES_C += \
72+
$(CORE_DIR)/shared/c/system_posix.c \
73+
74+
else ifneq (,$(findstring win,$(platform)))
75+
SOURCES_CPP += \
76+
$(CORE_DIR)/shared/c/system_windows.cpp \
77+
78+
endif
79+
6180
#beeb: all included
6281
#shared:
6382
#debug.cpp

src/libretro/core.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
/* TODO
22
3+
sudo docker run --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-mxe-win32-cross:gcc10 bash -c "cd /build/src/libretro && make clean && make -j6"
4+
5+
export platform=win32
6+
export ARCH=x86
7+
export MSYSTEM=MINGW32
8+
export AR=i686-w64-mingw32.static-ar
9+
export AS=i686-w64-mingw32.static-as
10+
export CC=i686-w64-mingw32.static-gcc
11+
export CXX=i686-w64-mingw32.static-g++
12+
export WINDRES=i686-w64-mingw32.static-windres
13+
14+
315
manage static 6502_internal.inl
4-
finish key layout, handle key not found
516
joypad controls
617
18+
core options
19+
autoboot on/off
20+
machine model
21+
722
load game with disc input (paste?)
823
set shift state on initial boot?
924
25+
include roms in .h
26+
run main cycle until screen update
27+
1028
different controls
1129
1230
fix sound distortion - more or less OK
@@ -20,6 +38,9 @@ tape input?
2038
hook up reset
2139
disc autostart?
2240
intelligent zoom?
41+
graphics line check (interlace, etc)?
42+
*tv0,0 *tv0,1 are not different for some reason? test program?
43+
fake interlace - based on register?
2344
2445
}
2546
@@ -581,7 +602,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
581602
info->geometry = (struct retro_game_geometry)
582603
{
583604
.base_width = TV_TEXTURE_WIDTH,
584-
.base_height = TV_TEXTURE_HEIGHT,
605+
.base_height = TV_TEXTURE_HEIGHT/2,
585606
.max_width = TV_TEXTURE_WIDTH,
586607
.max_height = TV_TEXTURE_HEIGHT,
587608
.aspect_ratio = aspect,
@@ -893,7 +914,8 @@ void retro_run(void)
893914

894915
std::vector<uint32_t> result(pixels, pixels + TV_TEXTURE_WIDTH * TV_TEXTURE_HEIGHT);
895916
unsigned stride = TV_TEXTURE_WIDTH;
896-
video_cb(pixels, TV_TEXTURE_WIDTH, TV_TEXTURE_HEIGHT, stride << 2);
917+
//video_cb(pixels, TV_TEXTURE_WIDTH, TV_TEXTURE_HEIGHT, stride << 2);
918+
video_cb(pixels, TV_TEXTURE_WIDTH, TV_TEXTURE_HEIGHT/2, stride << 3);
897919
const SoundDataUnit *aa, *bb;
898920
if (m_sound_output.GetConsumerBuffers(&aa, &na, &bb, &nb))
899921
{
@@ -1005,6 +1027,7 @@ bool retro_load_game(const struct retro_game_info *info)
10051027
core->SetSidewaysROM(15, LoadROM("BASIC2.ROM"));
10061028
core->SetSidewaysROM(14, LoadROM("DFS-2.26.ROM"));
10071029

1030+
core->SetKeyState(BeebKey_Shift,true);
10081031

10091032
std::string path = info->path;
10101033
core->SetDiscImage(0, DirectDiscImage::CreateForFile(path, nullptr));

src/shared/c/system_windows.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const char *GetErrorDescription(DWORD error) {
147147

148148
if (n == 0) {
149149
/* Bleargh. */
150-
150+
#ifndef B2_LIBRETRO_CORE
151151
#define CASE(X) \
152152
case (X): \
153153
return #X
@@ -182,7 +182,7 @@ const char *GetErrorDescription(DWORD error) {
182182
}
183183

184184
#undef CASE
185-
185+
#endif
186186
} else {
187187
/* For some reason, Windows error strings end with a carriage
188188
* return. */
@@ -308,7 +308,7 @@ int GetTerminalWidth(void) {
308308
// https://msdn.microsoft.com/en-us/library/windows/desktop/mt774976(v=vs.85).aspx...
309309
// but that's only from Windows 10 build 1607! Seems a bit rude to
310310
// require that when everything else only needs Vista+.
311-
311+
#ifndef B2_LIBRETRO_CORE
312312
#include <shared/pshpack8.h>
313313
struct THREADNAME_INFO {
314314
DWORD dwType;
@@ -359,7 +359,9 @@ void SetCurrentThreadNameInternal(const char *name) {
359359
}
360360
}
361361
}
362-
362+
#else
363+
void SetCurrentThreadNameInternal(const char *name) {}
364+
#endif
363365
//////////////////////////////////////////////////////////////////////////
364366
//////////////////////////////////////////////////////////////////////////
365367

src/shared/h/shared/system_windows.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
//////////////////////////////////////////////////////////////////////////
88
//////////////////////////////////////////////////////////////////////////
9-
9+
#ifndef B2_LIBRETRO_CORE
1010
#ifdef _WIN32_WINNT
1111
// 0x600 = Vista+; 0x601 = Win7+; 0x602 = Win8+;
1212
#if _WIN32_WINNT < 0x601
@@ -15,6 +15,9 @@
1515
#else
1616
#define _WIN32_WINNT 0x601
1717
#endif
18+
#else
19+
size_t strlcpy(char *dest, const char *src, size_t size);
20+
#endif
1821

1922
#define NOMINMAX
2023
#define WIN32_LEAN_AND_MEAN

0 commit comments

Comments
 (0)