Skip to content

Commit 20d14a8

Browse files
committed
Remerged kode54s origin with mine, fixed merging issues.
1 parent a1d2375 commit 20d14a8

File tree

7 files changed

+27
-50
lines changed

7 files changed

+27
-50
lines changed

main/savestates.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,8 @@ static int savestates_load_pj64(usf_state_t * state, unsigned char * ptr, unsign
405405
COPYARRAY(state->g_cp0_regs, curr, unsigned int, CP0_REGS_COUNT);
406406

407407
set_fpr_pointers(state, state->g_cp0_regs[CP0_STATUS_REG]);
408-
409-
// Don't do this, the floating point registers are in the correct order
410-
// if ((state->g_cp0_regs[CP0_STATUS_REG] & 0x04000000) == 0) // TODO not sure how pj64 handles this
411-
// shuffle_fpr_data(state, 0x04000000, 0);
408+
/*if ((state->g_cp0_regs[CP0_STATUS_REG] & 0x04000000) == 0) // pj64 always stores data depending on the current mode
409+
shuffle_fpr_data(state, 0x04000000, 0);*/
412410

413411
// Initialze the interupts
414412
vi_timer += state->g_cp0_regs[CP0_COUNT_REG];

prj/msvc/lazyusf2.vcxproj

+9-42
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
<Configuration>Debug</Configuration>
66
<Platform>Win32</Platform>
77
</ProjectConfiguration>
8-
<ProjectConfiguration Include="Release2015|Win32">
9-
<Configuration>Release2015</Configuration>
10-
<Platform>Win32</Platform>
11-
</ProjectConfiguration>
128
<ProjectConfiguration Include="Release|Win32">
139
<Configuration>Release</Configuration>
1410
<Platform>Win32</Platform>
@@ -64,23 +60,20 @@
6460
<ClCompile Include="..\..\rsp_hle\audio.c">
6561
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/audio_hle.obj</ObjectFileName>
6662
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/audio_hle.obj</ObjectFileName>
67-
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'">$(IntDir)/audio_hle.obj</ObjectFileName>
6863
</ClCompile>
6964
<ClCompile Include="..\..\rsp_hle\cicx105.c" />
7065
<ClCompile Include="..\..\rsp_hle\hle.c" />
7166
<ClCompile Include="..\..\rsp_hle\jpeg.c" />
7267
<ClCompile Include="..\..\rsp_hle\memory.c">
7368
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/memory_hle.obj</ObjectFileName>
7469
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/memory_hle.obj</ObjectFileName>
75-
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'">$(IntDir)/memory_hle.obj</ObjectFileName>
7670
</ClCompile>
7771
<ClCompile Include="..\..\rsp_hle\mp3.c" />
7872
<ClCompile Include="..\..\rsp_hle\musyx.c" />
7973
<ClCompile Include="..\..\rsp_hle\plugin.c" />
8074
<ClCompile Include="..\..\rsp_lle\rsp.c">
8175
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;ARCH_MIN_SSE2;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8276
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;ARCH_MIN_SSE2;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
83-
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'">WIN32;ARCH_MIN_SSE2;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8477
</ClCompile>
8578
<ClCompile Include="..\..\si\cic.c" />
8679
<ClCompile Include="..\..\si\game_controller.c" />
@@ -226,25 +219,19 @@
226219
<ProjectGuid>{8B2864CE-54E0-472D-A938-D942B5E835CC}</ProjectGuid>
227220
<Keyword>Win32Proj</Keyword>
228221
<RootNamespace>lazyusf2</RootNamespace>
229-
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
222+
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
230223
</PropertyGroup>
231224
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
232225
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
233226
<ConfigurationType>StaticLibrary</ConfigurationType>
234227
<UseDebugLibraries>true</UseDebugLibraries>
235-
<PlatformToolset>v100</PlatformToolset>
228+
<PlatformToolset>v141_xp</PlatformToolset>
236229
<CharacterSet>Unicode</CharacterSet>
237230
</PropertyGroup>
238231
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
239232
<ConfigurationType>StaticLibrary</ConfigurationType>
240233
<UseDebugLibraries>false</UseDebugLibraries>
241-
<PlatformToolset>v100</PlatformToolset>
242-
<CharacterSet>Unicode</CharacterSet>
243-
</PropertyGroup>
244-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'" Label="Configuration">
245-
<ConfigurationType>StaticLibrary</ConfigurationType>
246-
<UseDebugLibraries>false</UseDebugLibraries>
247-
<PlatformToolset>v100</PlatformToolset>
234+
<PlatformToolset>v141_xp</PlatformToolset>
248235
<CharacterSet>Unicode</CharacterSet>
249236
</PropertyGroup>
250237
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -256,9 +243,6 @@
256243
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
257244
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
258245
</ImportGroup>
259-
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'" Label="PropertySheets">
260-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
261-
</ImportGroup>
262246
<PropertyGroup Label="UserMacros" />
263247
<PropertyGroup />
264248
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -268,8 +252,10 @@
268252
<WarningLevel>Level3</WarningLevel>
269253
<Optimization>Disabled</Optimization>
270254
<PreprocessorDefinitions>WIN32;DYNAREC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
271-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
255+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
272256
<AdditionalIncludeDirectories>../..;../../rsp_hle/msvc-compat;../../../foobar/zlib</AdditionalIncludeDirectories>
257+
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
258+
<AdditionalOptions>/d2notypeopt %(AdditionalOptions)</AdditionalOptions>
273259
</ClCompile>
274260
<Link>
275261
<SubSystem>Windows</SubSystem>
@@ -285,31 +271,12 @@
285271
<FunctionLevelLinking>true</FunctionLevelLinking>
286272
<IntrinsicFunctions>true</IntrinsicFunctions>
287273
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;DYNAREC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
288-
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
289-
<FloatingPointModel>Fast</FloatingPointModel>
290-
<AdditionalIncludeDirectories>../..;../../rsp_hle/msvc-compat;../../../foobar/zlib</AdditionalIncludeDirectories>
291-
<BufferSecurityCheck>false</BufferSecurityCheck>
292-
</ClCompile>
293-
<Link>
294-
<SubSystem>Windows</SubSystem>
295-
<GenerateDebugInformation>true</GenerateDebugInformation>
296-
<EnableCOMDATFolding>true</EnableCOMDATFolding>
297-
<OptimizeReferences>true</OptimizeReferences>
298-
</Link>
299-
</ItemDefinitionGroup>
300-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release2015|Win32'">
301-
<ClCompile>
302-
<WarningLevel>Level3</WarningLevel>
303-
<PrecompiledHeader>
304-
</PrecompiledHeader>
305-
<Optimization>MaxSpeed</Optimization>
306-
<FunctionLevelLinking>true</FunctionLevelLinking>
307-
<IntrinsicFunctions>true</IntrinsicFunctions>
308-
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;DYNAREC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
309-
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
274+
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
310275
<FloatingPointModel>Fast</FloatingPointModel>
311276
<AdditionalIncludeDirectories>../..;../../rsp_hle/msvc-compat;../../../foobar/zlib</AdditionalIncludeDirectories>
312277
<BufferSecurityCheck>false</BufferSecurityCheck>
278+
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
279+
<AdditionalOptions>/d2notypeopt</AdditionalOptions>
313280
</ClCompile>
314281
<Link>
315282
<SubSystem>Windows</SubSystem>

r4300/interupt.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void init_interupt(usf_state_t * state)
333333

334334
clear_queue(state);
335335
add_interupt_event_count(state, VI_INT, state->g_vi.next_vi);
336-
add_interrupt_event_count(state, SPECIAL_INT, 0x80000000);
336+
add_interupt_event_count(state, SPECIAL_INT, 0x80000000);
337337
add_interupt_event_count(state, COMPARE_INT, 0);
338338
}
339339

test/bench.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ double get_seconds()
126126
return (double)(t.tv_sec) + (double)(t.tv_usec) * 0.000001;
127127
}
128128

129+
static void print_message( void * unused, const char * message )
130+
{
131+
fputs( message, stderr );
132+
}
133+
129134
int main(int argc, char ** argv)
130135
{
131136
if ( argc == 2 || argc == 3 )
@@ -139,7 +144,7 @@ int main(int argc, char ** argv)
139144

140145
usf_clear(state);
141146

142-
if ( psf_load( argv[1], &stdio_callbacks, 0x21, usf_loader, 0, usf_info, 0, 1 ) <= 0 )
147+
if ( psf_load( argv[1], &stdio_callbacks, 0x21, usf_loader, 0, usf_info, 0, 1, print_message, 0 ) <= 0 )
143148
return 1;
144149

145150
usf_set_compare(state, enable_compare);

test/dumpresampled.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ static int usf_info(void * context, const char * name, const char * value)
118118
return 0;
119119
}
120120

121+
static void print_message(void * unused, const char * message)
122+
{
123+
fputs(message, stderr);
124+
}
125+
121126
int main(int argc, char ** argv)
122127
{
123128
if ( argc == 3 )
@@ -135,7 +140,7 @@ int main(int argc, char ** argv)
135140

136141
usf_clear(state);
137142

138-
if ( psf_load( argv[1], &stdio_callbacks, 0x21, usf_loader, 0, usf_info, 0, 1 ) <= 0 )
143+
if ( psf_load( argv[1], &stdio_callbacks, 0x21, usf_loader, 0, usf_info, 0, 1, print_message, 0 ) <= 0 )
139144
return 1;
140145

141146
usf_set_compare(state, enable_compare);

usf/usf.c

+1
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ const char * usf_render_resampled(void * state, int16_t * buffer, size_t count,
346346
unsigned long samples_to_remove = samples_buffered;
347347
if (samples_to_remove > count)
348348
samples_to_remove = count;
349+
count -= samples_to_remove;
349350
while (samples_to_remove--)
350351
resampler_remove_sample(USF_STATE->resampler);
351352
if (!count)

vi/vi_controller.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int write_vi_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask)
7070
struct vi_controller* vi = (struct vi_controller*)opaque;
7171
usf_state_t * state = vi->r4300->state;
7272
uint32_t reg = vi_reg(address);
73+
int32_t count_per_scanline;
7374

7475
switch(reg)
7576
{
@@ -93,7 +94,7 @@ int write_vi_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask)
9394

9495
case VI_V_SYNC_REG:
9596
masked_write(&vi->regs[reg], value, mask);
96-
int32_t count_per_scanline = ((float)state->ROM_PARAMS.aidacrate / (float)state->ROM_PARAMS.vilimit) / (vi->regs[VI_V_SYNC_REG] + 1);
97+
count_per_scanline = ((float)state->ROM_PARAMS.aidacrate / (float)state->ROM_PARAMS.vilimit) / (vi->regs[VI_V_SYNC_REG] + 1);
9798
vi->delay = (vi->regs[VI_V_SYNC_REG] + 1) * count_per_scanline;
9899
if (vi->regs[VI_V_SYNC_REG] != 0 && vi->next_vi == 0)
99100
{

0 commit comments

Comments
 (0)