Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit f1b3678

Browse files
authored
Merge pull request #1623 from davidgfnet/cleanup3
Stop using std::mutex on Windows builds.
2 parents 1cf45de + 3057bb6 commit f1b3678

33 files changed

+342
-321
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ if (${HOST_OS} EQUAL ${OS_WINDOWS})
179179

180180
list(APPEND osd_SRCS ${d_core}/windows/winmain.cpp)
181181
list(APPEND osd_SRCS ${d_core}/windows/win_vmem.cpp)
182+
list(APPEND osd_SRCS ${d_core}/oslib/windows/threading.cpp)
182183
list(APPEND osd_SRCS ${d_aout}/audiobackend_directsound.cpp)
183184

184185

@@ -190,6 +191,7 @@ elseif (${HOST_OS} EQUAL ${OS_LINUX} OR ${HOST_OS} EQUAL ${OS_ANDROID})
190191
list(APPEND osd_SRCS
191192
${d_core}/linux/common.cpp
192193
${d_core}/linux/context.cpp
194+
${d_core}/linux/oslib/posix/threading.cpp
193195
${d_core}/linux/nixprof/nixprof.cpp
194196

195197
${d_aout}/audiobackend_oss.cpp # add option

core/core.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ ifndef NO_NIXPROF
5858
endif
5959

6060
ifdef FOR_ANDROID
61-
RZDCY_MODULES += android/ deps/libandroid/ linux/
61+
RZDCY_MODULES += android/ deps/libandroid/ linux/ oslib/posix/
6262
endif
6363

6464
ifdef USE_SDL
6565
RZDCY_MODULES += sdl/
6666
endif
6767

6868
ifdef FOR_LINUX
69-
RZDCY_MODULES += linux-dist/ linux/
69+
RZDCY_MODULES += linux-dist/ linux/ oslib/posix/
7070
endif
7171

7272
ifdef FOR_WINDOWS
73-
RZDCY_MODULES += windows/
73+
RZDCY_MODULES += windows/ oslib/windows/
7474
endif
7575

7676
ifdef FOR_PANDORA

core/deps/coreio/coreio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <netdb.h>
2727
#include <unistd.h>
2828
#else
29+
#include <windows.h>
2930
#pragma comment (lib, "wsock32.lib")
3031
#endif
3132
#endif

core/hw/gdrom/gdromv3.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void FillReadBuffer()
108108

109109
if (count > 32)
110110
{
111-
hint = max(count - 32, (u32)32);
111+
hint = std::max(count - 32, (u32)32);
112112
count = 32;
113113
}
114114

@@ -981,7 +981,7 @@ static int getGDROMTicks()
981981
if (SB_GDLEN - SB_GDLEND > 10240)
982982
return 1000000; // Large transfers: GD-ROM transfer rate 1.8 MB/s
983983
else
984-
return min((u32)10240, SB_GDLEN - SB_GDLEND) * 2; // Small transfers: Max G1 bus rate: 50 MHz x 16 bits
984+
return std::min((u32)10240, SB_GDLEN - SB_GDLEND) * 2; // Small transfers: Max G1 bus rate: 50 MHz x 16 bits
985985
}
986986
else
987987
return 0;
@@ -1013,10 +1013,10 @@ int GDRomschd(int i, int c, int j)
10131013
if (read_params.remaining_sectors == 0)
10141014
{
10151015
//make sure we don't underrun the cache :)
1016-
len = min(len, read_buff.cache_size);
1016+
len = std::min(len, read_buff.cache_size);
10171017
}
10181018

1019-
len = min(len, (u32)10240);
1019+
len = std::min(len, (u32)10240);
10201020
// do we need to do this for GDROM DMA?
10211021
if(0x8201 != (dmaor &DMAOR_MASK))
10221022
{

core/hw/maple/maple_devs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,18 +1125,18 @@ struct maple_sega_purupuru : maple_base
11251125
INC = 0;
11261126
bool CNT = VIBSET & 1;
11271127

1128-
float power = min((POW_POS + POW_NEG) / 7.0, 1.0);
1128+
float power = std::min((POW_POS + POW_NEG) / 7.0, 1.0);
11291129

11301130
u32 duration_ms;
11311131
if (FREQ > 0 && (!CNT || INC))
1132-
duration_ms = min((int)(1000 * (INC ? abs(INC) * max(POW_POS, POW_NEG) : 1) / FREQ), (int)AST_ms);
1132+
duration_ms = std::min((int)(1000 * (INC ? abs(INC) * std::max(POW_POS, POW_NEG) : 1) / FREQ), (int)AST_ms);
11331133
else
11341134
duration_ms = AST_ms;
11351135
float inclination;
11361136
if (INC == 0 || power == 0)
11371137
inclination = 0.0;
11381138
else
1139-
inclination = FREQ / (1000.0 * INC * max(POW_POS, POW_NEG));
1139+
inclination = FREQ / (1000.0 * INC * std::max(POW_POS, POW_NEG));
11401140
config->SetVibration(power, inclination, duration_ms);
11411141
}
11421142

core/hw/modem/picoppp.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#include "net_platform.h"
4141

4242
#include "types.h"
43+
#include "oslib/threading.h"
4344
#include "cfg/cfg.h"
4445
#include "picoppp.h"
4546

@@ -695,11 +696,11 @@ static void *pico_thread_func(void *)
695696
{
696697
pico_stack_init();
697698
pico_stack_inited = true;
698-
#if _WIN32
699-
static WSADATA wsaData;
700-
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0)
701-
printf("WSAStartup failed\n");
702-
#endif
699+
#if _WIN32
700+
static WSADATA wsaData;
701+
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0)
702+
printf("WSAStartup failed\n");
703+
#endif
703704
}
704705

705706
// PPP

core/hw/naomi/gdcartridge.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ void GDCartridge::device_reset()
594594
void *GDCartridge::GetDmaPtr(u32 &size)
595595
{
596596
dimm_cur_address = DmaOffset & (dimm_data_size-1);
597-
size = min(size, dimm_data_size - dimm_cur_address);
597+
size = std::min(size, dimm_data_size - dimm_cur_address);
598598
return dimm_data + dimm_cur_address;
599599
}
600600

@@ -608,7 +608,7 @@ void GDCartridge::AdvancePtr(u32 size)
608608
bool GDCartridge::Read(u32 offset, u32 size, void *dst)
609609
{
610610
u32 addr = offset & (dimm_data_size-1);
611-
memcpy(dst, &dimm_data[addr], min(size, dimm_data_size - addr));
611+
memcpy(dst, &dimm_data[addr], std::min(size, dimm_data_size - addr));
612612
return true;
613613
}
614614

core/hw/naomi/m1cartridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class M1Cartridge : public NaomiCartridge
2626
{
2727
if (encryption)
2828
{
29-
size = min(size, (u32)sizeof(buffer));
29+
size = std::min(size, (u32)sizeof(buffer));
3030
return buffer;
3131
}
3232
else

core/hw/naomi/m4cartridge.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void *M4Cartridge::GetDmaPtr(u32 &limit)
158158
int fpr_num = m4id & 0x7f;
159159

160160
if (((rom_cur_address >> 26) & 0x07) < fpr_num) {
161-
limit = min(limit, (u32)2);
161+
limit = std::min(limit, (u32)2);
162162
return &cfidata[rom_cur_address & 0xffff];
163163
}
164164
}
@@ -176,15 +176,15 @@ void *M4Cartridge::GetDmaPtr(u32 &limit)
176176
}
177177
if (encryption)
178178
{
179-
limit = min(limit, (u32)sizeof(buffer));
179+
limit = std::min(limit, (u32)sizeof(buffer));
180180
return buffer;
181181

182182
}
183183
else
184184
{
185185
if ((DmaOffset & 0x1ffffffe) < RomSize)
186186
{
187-
limit = min(limit, RomSize - (DmaOffset & 0x1ffffffe));
187+
limit = std::min(limit, RomSize - (DmaOffset & 0x1ffffffe));
188188
return RomPtr + (DmaOffset & 0x1ffffffe);
189189
}
190190
else

core/hw/naomi/naomi_cart.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Cartridge *CurrentCartridge;
1616
bool bios_loaded = false;
1717

1818
#if HOST_OS == OS_WINDOWS
19+
#define NOMINMAX
20+
#include <windows.h>
1921
typedef HANDLE fd_t;
2022
#define INVALID_FD INVALID_HANDLE_VALUE
2123
#else

0 commit comments

Comments
 (0)