Skip to content

Commit 30f4ec2

Browse files
committed
Attempt to get it working with MSVC
1 parent 76934c6 commit 30f4ec2

29 files changed

+1087
-81
lines changed

ai/ai_controller.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <stddef.h>
2626
#include <stdint.h>
2727

28+
#include "osal/preproc.h"
29+
2830
struct r4300_core;
2931
struct ri_controller;
3032
struct vi_controller;
@@ -63,7 +65,7 @@ struct ai_controller
6365
struct vi_controller* vi;
6466
};
6567

66-
static inline uint32_t ai_reg(uint32_t address)
68+
static osal_inline uint32_t ai_reg(uint32_t address)
6769
{
6870
return (address & 0xffff) >> 2;
6971
}

api/callbacks.c

+4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ void DebugMessage(usf_state_t * state, int level, const char *message, ...)
6363
state->error_message[ len++ ] = '\n';
6464

6565
va_start(args, message);
66+
#if _MSC_VER >= 1300
67+
vsprintf_s(state->error_message + len, 16384 - len, message, args);
68+
#else
6669
vsprintf(state->error_message + len, message, args);
70+
#endif
6771
va_end(args);
6872

6973
state->last_error = state->error_message;

main/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ m64p_error main_start(usf_state_t * state)
134134
to_little_endian_buffer(&RDRAMSize, 4, 1);
135135

136136
/* take the r4300 emulator mode from the config file at this point and cache it in a global variable */
137-
state->r4300emu = 0;
137+
state->r4300emu = 2;
138138

139139
/* set some other core parameters based on the config file values */
140140
state->no_compiled_jump = 0;

main/savestates.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ static int savestates_load_pj64(usf_state_t * state, unsigned char * ptr, unsign
347347
char buffer[1024];
348348
unsigned int vi_timer, SaveRDRAMSize;
349349
int i;
350+
#ifdef DYNAREC
350351
unsigned long long dummy;
352+
#endif
351353

352354
unsigned char header[8];
353355

@@ -611,9 +613,13 @@ static int savestates_load_pj64(usf_state_t * state, unsigned char * ptr, unsign
611613
for (i = 0; i < 0x100000; i++)
612614
state->invalid_code[i] = 1;
613615
}
616+
#ifdef DYNAREC
614617
*(void **)&state->return_address = (void *)&dummy;
618+
#endif
615619
generic_jump_to(state, state->last_addr);
616-
*(void **)&state->return_address = (void *)0;
620+
#ifdef DYNAREC
621+
*(void **)&state->return_address = (void *)0;
622+
#endif
617623
#endif
618624

619625
// assert(savestateData+savestateSize == curr)

memory/memory.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,17 @@
5959
#include <stddef.h>
6060
#include <stdint.h>
6161

62+
#include "osal/preproc.h"
63+
6264
typedef int (*readfn)(void*,uint32_t,uint32_t*);
6365
typedef int (*writefn)(void*,uint32_t,uint32_t,uint32_t);
6466

65-
static inline unsigned int bshift(uint32_t address)
67+
static osal_inline unsigned int bshift(uint32_t address)
6668
{
6769
return ((address & 3) ^ 3) << 3;
6870
}
6971

70-
static inline unsigned int hshift(uint32_t address)
72+
static osal_inline unsigned int hshift(uint32_t address)
7173
{
7274
return ((address & 2) ^ 2) << 3;
7375
}

memory/memory.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858

5959
#endif
6060

61-
static inline void masked_write(uint32_t* dst, uint32_t value, uint32_t mask)
61+
#include "osal/preproc.h"
62+
63+
static osal_inline void masked_write(uint32_t* dst, uint32_t value, uint32_t mask)
6264
{
6365
*dst = (*dst & ~mask) | (value & mask);
6466
}

pi/cart_rom.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <stddef.h>
2626
#include <stdint.h>
2727

28+
#include "osal/preproc.h"
29+
2830
struct cart_rom
2931
{
3032
uint8_t* rom;
@@ -33,7 +35,7 @@ struct cart_rom
3335
uint32_t last_write;
3436
};
3537

36-
static inline uint32_t rom_address(uint32_t address)
38+
static osal_inline uint32_t rom_address(uint32_t address)
3739
{
3840
return (address & 0x03fffffc);
3941
}

pi/pi_controller.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ struct pi_controller
5858
struct ri_controller* ri;
5959
};
6060

61-
static inline uint32_t pi_reg(uint32_t address)
61+
#include "osal/preproc.h"
62+
63+
static osal_inline uint32_t pi_reg(uint32_t address)
6264
{
6365
return (address & 0xffff) >> 2;
6466
}

prj/msvc/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Debug
2+
Release
3+
*.user

0 commit comments

Comments
 (0)