Resync 0.21

This commit is contained in:
Bernhard Schelling 2021-12-13 23:46:48 +09:00
parent 3d0266b01c
commit 2cfb6c7410
22 changed files with 2322 additions and 2598 deletions

View File

@ -40,7 +40,7 @@ ifneq ($(ISWIN),)
COMMONFLAGS += -pthread
else ifneq (,$(findstring ios,$(platform)))
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
OUTNAME := dosbox_pure_libretro_ios.dylib
MINVERSION :=
@ -56,31 +56,28 @@ ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
else
MINVERSION = -miphoneos-version-min=5.0
endif
COMMONFLAGS += $(MINVERSION)
COMMONFLAGS += $(MINVERSION) -Wno-ignored-optimization-argument -Wno-unknown-warning-option
else ifeq ($(platform),tvos-arm64)
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
endif
OUTNAME := dosbox_pure_libretro_tvos.dylib
CXX = c++ -arch arm64 -isysroot $(IOSSDK)
LDFLAGS := -Wl,-dead_strip
COMMONFLAGS += -DDISABLE_DYNAREC=1
COMMONFLAGS += -DDISABLE_DYNAREC=1 -Wno-unknown-warning-option
else ifneq ($(ISMAC),)
OUTNAME := dosbox_pure_libretro.dylib
CXX ?= c++
LDFLAGS := -Wl,-dead_strip
COMMONFLAGS += -pthread
ifeq ($(CROSS_COMPILE),1)
COMMONFLAGS += -DDISABLE_DYNAREC=1
TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT)
COMMONFLAGS += $(TARGET_RULE)
LDFLAGS += $(TARGET_RULE)
COMMONFLAGS += -pthread -Wno-unknown-warning-option
ifeq ($(CROSS_COMPILE),1)
COMMONFLAGS += -DDISABLE_DYNAREC=1
TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT)
COMMONFLAGS += $(TARGET_RULE)
LDFLAGS += $(TARGET_RULE)
endif
COMMONFLAGS += $(ARCHFLAGS)
LDFLAGS += $(ARCHFLAGS)
else ifeq ($(platform),windows) # For MSYS2 only
OUTNAME := dosbox_pure_libretro.dll
CXX ?= g++
@ -114,14 +111,14 @@ else ifeq ($(platform),wii)
CXX := $(DEVKITPPC)/bin/powerpc-eabi-g++
AR := $(DEVKITPPC)/bin/powerpc-eabi-ar
COMMONFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -fpermissive
COMMONFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int -D__POWERPC__ -D__ppc__ -DMSB_FIRST -DWORDS_BIGENDIAN=1
COMMONFLAGS += -U__INT32_TYPE__ -U__UINT32_TYPE__ -D__INT32_TYPE__=int -D__POWERPC__ -D__ppc__ -DMSB_FIRST -DWORDS_BIGENDIAN=1
STATIC_LINKING = 1
else ifeq ($(platform),wiiu)
OUTNAME := dosbox_pure_libretro_wiiu.a
CXX := $(DEVKITPPC)/bin/powerpc-eabi-g++
AR := $(DEVKITPPC)/bin/powerpc-eabi-ar
COMMONFLAGS += -DGEKKO -DWIIU -DHW_RVL -mcpu=750 -meabi -mhard-float -I./deps/include/
COMMONFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int -D__POWERPC__ -D__ppc__ -DMSB_FIRST -DWORDS_BIGENDIAN=1
COMMONFLAGS += -DGEKKO -DWIIU -DHW_RVL -mcpu=750 -meabi -mhard-float
COMMONFLAGS += -U__INT32_TYPE__ -U__UINT32_TYPE__ -D__INT32_TYPE__=int -D__POWERPC__ -D__ppc__ -DMSB_FIRST -DWORDS_BIGENDIAN=1 -DGX_PTHREAD_LEGACY
STATIC_LINKING = 1
else ifeq ($(platform),libnx)
OUTNAME := dosbox_pure_libretro_libnx.a

View File

@ -38,21 +38,6 @@ static retro_core_option_v2_definition option_defs[] =
"false"
},
// Emulation
#ifndef DBP_REMOVE_OLD_TIMING
{
"dosbox_pure_experimental_timing_mode",
"Timing Mode (restart required)", NULL,
"[Experimental] This option will hopefully go away with only 'New Mode' remaining." "\n"
"Old Mode: Emulates in background, frontend has no control over frame timing." "\n"
"New Mode: Frontend times frame drawing, improves frame timing and syncing.", NULL,
"Emulation",
{
{ "legacy", "Old Mode" },
{ "new", "New Mode" },
},
"legacy"
},
#endif
{
"dosbox_pure_force60fps",
"Force 60 FPS Output", NULL,
@ -118,6 +103,7 @@ static retro_core_option_v2_definition option_defs[] =
{
{ "default", "Default" },
{ "low", "Lowest latency - See CPU usage setting below!" },
{ "variable", "Irregular latency - Might improve performance on low-end devices" },
},
"default"
},

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="DisplayText">
<PropertyGroup Label="UserMacros">
<VisualStudioYear Condition="'$(VisualStudioVersion)' == '11.0' Or '$(PlatformToolsetVersion)' == '110' Or '$(MSBuildToolsVersion)' == '4.0'">2012</VisualStudioYear>
@ -79,6 +79,7 @@
</ClCompile>
<ClCompile Condition="'$(Configuration)'=='Debug'">
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -91,7 +92,8 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<OmitFramePointers>true</OmitFramePointers>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<WholeProgramOptimization>true</WholeProgramOptimization>
<!-- WholeProgramOptimization>true</WholeProgramOptimization -->
<WholeProgramOptimization>false</WholeProgramOptimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FloatingPointExceptions>false</FloatingPointExceptions>
<EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
@ -108,7 +110,8 @@
<Link Condition="'$(Configuration)'=='Release'">
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<!-- LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration -->
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<IgnoreEmbeddedIDL>true</IgnoreEmbeddedIDL>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>

View File

@ -116,13 +116,13 @@
<Filter>src\fpu</Filter>
</ClCompile>
<ClCompile Include="src\gui\midi.cpp">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClCompile>
<ClCompile Include="src\gui\render.cpp">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClCompile>
<ClCompile Include="src\gui\render_scalers.cpp">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClCompile>
<ClCompile Include="src\hardware\adlib.cpp">
<Filter>src\hardware</Filter>
@ -591,25 +591,25 @@
<Filter>src\fpu</Filter>
</ClInclude>
<ClInclude Include="src\gui\midi_mt32.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\midi_retro.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\midi_tsf.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\render_glsl.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\render_loops.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\render_scalers.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\gui\render_simple.h">
<Filter>src\gui</Filter>
<Filter>src\hardware\gui</Filter>
</ClInclude>
<ClInclude Include="src\hardware\adlib.h">
<Filter>src\hardware</Filter>
@ -653,7 +653,6 @@
<Filter Include="src\cpu" />
<Filter Include="src\dos" />
<Filter Include="src\fpu" />
<Filter Include="src\gui" />
<Filter Include="src\hardware\mame" />
<Filter Include="src\hardware\serialport" />
<Filter Include="src\hardware" />
@ -661,5 +660,6 @@
<Filter Include="src\misc" />
<Filter Include="src\shell" />
<Filter Include="src" />
<Filter Include="src\hardware\gui" />
</ItemGroup>
</Project>

View File

@ -112,6 +112,10 @@
#define C_DYNREC 1
#define C_UNALIGNED_MEMORY 1
#define C_TARGETCPU MIPSEL
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC)
// DYNREC crashes on WiiU so this is disabled for now
//#define C_DYNREC 1
//#define C_TARGETCPU POWERPC
#endif
// ----- HEADERS: Define if headers exist in build environment

View File

@ -63,6 +63,10 @@
#define CROSS_FILE 1
#define CROSS_DIR 2
#if defined (WIN32)
// DBP: Fix warning when building with MSYS2
#ifdef ftruncate
#undef ftruncate
#endif
#define ftruncate(blah,blah2) chsize(blah,blah2)
#endif

View File

@ -85,7 +85,7 @@ enum FPU_Round {
ROUND_Chop = 3
};
typedef struct {
typedef struct FPU_rec {
FPU_Reg regs[9];
FPU_P_Reg p_regs[9];
FPU_Tag tags[9];

View File

@ -1,4 +1,14 @@
APP_PLATFORM := android-16
APP_STL := c++_static
APP_ABI := armeabi-v7a arm64-v8a
APP_ABI := arm64-v8a
#APP_ABI := armeabi-v7a
NDK_TOOLCHAIN_VERSION := clang
APP_STRIP_MODE := none
# create tombstone
#D:\dev\android\android-sdk\platform-tools\adb shell "ps -A | grep retro"
#D:\dev\android\android-sdk\platform-tools\adb shell "kill -11 17563"
# get address location
#D:\dev\android\android-ndk\prebuilt\windows-x86_64\bin\gdb.exe ..\obj\local\arm64-v8a\libretro.so -ex "list*0x000000000006f630" -ex quit

View File

@ -138,6 +138,7 @@ static struct {
#define MIPSEL 0x03
#define ARMV4LE 0x04
#define ARMV7LE 0x05
#define POWERPC 0x06
#define ARMV8LE 0x07
#if C_TARGETCPU == X86_64
@ -148,10 +149,17 @@ static struct {
#include "core_dynrec/risc_mipsel32.h"
#elif (C_TARGETCPU == ARMV4LE) || (C_TARGETCPU == ARMV7LE)
#include "core_dynrec/risc_armv4le.h"
#elif C_TARGETCPU == POWERPC
#include "core_dynrec/risc_ppc.h"
#elif C_TARGETCPU == ARMV8LE
#include "core_dynrec/risc_armv8le.h"
#endif
#ifndef WORDS_BIGENDIAN
#define gen_add_LE gen_add
#define gen_mov_LE_word_to_reg gen_mov_word_to_reg
#endif
#include "core_dynrec/decoder.h"
CacheBlockDynRec * LinkBlocks(BlockReturn ret) {

View File

@ -995,10 +995,10 @@ skip_extend_word:
// succeeded, use the pointer to avoid code invalidation
if (!addseg) {
if (!scaled_reg_used) {
gen_mov_word_to_reg(ea_reg,(void*)val,true);
gen_mov_LE_word_to_reg(ea_reg,(void*)val,true);
} else {
DYN_LEA_MEM_REG_VAL(ea_reg,NULL,scaled_reg,scale,0);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
}
} else {
if (!scaled_reg_used) {
@ -1006,7 +1006,7 @@ skip_extend_word:
} else {
DYN_LEA_SEG_PHYS_REG_VAL(ea_reg,(decode.seg_prefix_used ? decode.seg_prefix : seg_base),scaled_reg,scale,0);
}
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
}
return;
}
@ -1047,10 +1047,10 @@ skip_extend_word:
if (!addseg) {
if (!scaled_reg_used) {
MOV_REG_VAL_TO_HOST_REG(ea_reg,base_reg);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
} else {
DYN_LEA_REG_VAL_REG_VAL(ea_reg,base_reg,scaled_reg,scale,0);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
}
} else {
if (!scaled_reg_used) {
@ -1059,7 +1059,7 @@ skip_extend_word:
DYN_LEA_SEG_PHYS_REG_VAL(ea_reg,(decode.seg_prefix_used ? decode.seg_prefix : seg_base),scaled_reg,scale,0);
}
ADD_REG_VAL_TO_HOST_REG(ea_reg,base_reg);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
}
return;
}
@ -1124,11 +1124,11 @@ skip_extend_word:
// succeeded, use the pointer to avoid code invalidation
if (!addseg) {
MOV_REG_VAL_TO_HOST_REG(ea_reg,base_reg);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
} else {
MOV_SEG_PHYS_TO_HOST_REG(ea_reg,(decode.seg_prefix_used ? decode.seg_prefix : seg_base));
ADD_REG_VAL_TO_HOST_REG(ea_reg,base_reg);
gen_add(ea_reg,(void*)val);
gen_add_LE(ea_reg,(void*)val);
}
return;
}

View File

@ -252,12 +252,12 @@ static void dyn_prep_word_imm(Bit8u reg) {
Bitu val;
if (decode.big_op) {
if (decode_fetchd_imm(val)) {
gen_mov_word_to_reg(FC_OP2,(void*)val,true);
gen_mov_LE_word_to_reg(FC_OP2,(void*)val,true);
return;
}
} else {
if (decode_fetchw_imm(val)) {
gen_mov_word_to_reg(FC_OP2,(void*)val,false);
gen_mov_LE_word_to_reg(FC_OP2,(void*)val,false);
return;
}
}
@ -289,13 +289,13 @@ static void dyn_mov_word_imm(Bit8u reg) {
Bitu val;
if (decode.big_op) {
if (decode_fetchd_imm(val)) {
gen_mov_word_to_reg(FC_OP1,(void*)val,true);
gen_mov_LE_word_to_reg(FC_OP1,(void*)val,true);
MOV_REG_WORD32_FROM_HOST_REG(FC_OP1,reg);
return;
}
} else {
if (decode_fetchw_imm(val)) {
gen_mov_word_to_reg(FC_OP1,(void*)val,false);
gen_mov_LE_word_to_reg(FC_OP1,(void*)val,false);
MOV_REG_WORD16_FROM_HOST_REG(FC_OP1,reg);
return;
}
@ -332,7 +332,7 @@ static void dyn_mov_byte_direct_al() {
if (decode.big_addr) {
Bitu val;
if (decode_fetchd_imm(val)) {
gen_add(FC_ADDR,(void*)val);
gen_add_LE(FC_ADDR,(void*)val);
} else {
gen_add_imm(FC_ADDR,(Bit32u)val);
}

View File

@ -2157,7 +2157,7 @@ void CPU_Disable_SkipAutoAdjust(void) {
#endif
#if !defined(C_DBP_CUSTOMTIMING) || !defined(DBP_REMOVE_OLD_TIMING)
#ifndef C_DBP_CUSTOMTIMING
extern Bit32s ticksDone;
extern Bit32u ticksScheduled;

View File

@ -68,6 +68,12 @@ static inline int nxmunmap(void *addr, size_t)
}
#endif
#ifdef WIIU
// WiiU has just shy of 8MiB RWX RAM available using the current method
#define WUP_RWX_MEM_BASE 0x00802000
#define WUP_RWX_MEM_END 0x01000000
#endif
class CodePageHandlerDynRec; // forward
// basic cache block representation
@ -205,7 +211,7 @@ public:
if (host_readb(hostmem+addr)==(Bit8u)val) return;
host_writeb(hostmem+addr,val);
// see if there's code where we are writing to
if (!host_readb(&write_map[addr])) {
if (!write_map[addr]) {
if (active_blocks) return; // still some blocks in this page
active_count--;
if (!active_count) Release(); // delay page releasing until active_count is zero
@ -226,7 +232,7 @@ public:
if (host_readw(hostmem+addr)==(Bit16u)val) return;
host_writew(hostmem+addr,val);
// see if there's code where we are writing to
if (!host_readw(&write_map[addr])) {
if (!*(Bit16u*)&write_map[addr]) {
if (active_blocks) return; // still some blocks in this page
active_count--;
if (!active_count) Release(); // delay page releasing until active_count is zero
@ -235,7 +241,7 @@ public:
invalidation_map=(Bit8u*)malloc(4096);
memset(invalidation_map,0,4096);
}
#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY)
#if !defined(C_UNALIGNED_MEMORY)
host_writew(&invalidation_map[addr],
host_readw(&invalidation_map[addr])+0x101);
#else
@ -252,7 +258,7 @@ public:
if (host_readd(hostmem+addr)==(Bit32u)val) return;
host_writed(hostmem+addr,val);
// see if there's code where we are writing to
if (!host_readd(&write_map[addr])) {
if (!*(Bit32u*)&write_map[addr]) {
if (active_blocks) return; // still some blocks in this page
active_count--;
if (!active_count) Release(); // delay page releasing until active_count is zero
@ -261,7 +267,7 @@ public:
invalidation_map=(Bit8u*)malloc(4096);
memset(invalidation_map,0,4096);
}
#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY)
#if !defined(C_UNALIGNED_MEMORY)
host_writed(&invalidation_map[addr],
host_readd(&invalidation_map[addr])+0x1010101);
#else
@ -305,7 +311,7 @@ public:
addr&=4095;
if (host_readw(hostmem+addr)==(Bit16u)val) return false;
// see if there's code where we are writing to
if (!host_readw(&write_map[addr])) {
if (!*(Bit16u*)&write_map[addr]) {
if (!active_blocks) {
// no blocks left in this page, still delay the page releasing a bit
active_count--;
@ -316,7 +322,7 @@ public:
invalidation_map=(Bit8u*)malloc(4096);
memset(invalidation_map,0,4096);
}
#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY)
#if !defined(C_UNALIGNED_MEMORY)
host_writew(&invalidation_map[addr],
host_readw(&invalidation_map[addr])+0x101);
#else
@ -338,7 +344,7 @@ public:
addr&=4095;
if (host_readd(hostmem+addr)==(Bit32u)val) return false;
// see if there's code where we are writing to
if (!host_readd(&write_map[addr])) {
if (!*(Bit32u*)&write_map[addr]) {
if (!active_blocks) {
// no blocks left in this page, still delay the page releasing a bit
active_count--;
@ -349,7 +355,7 @@ public:
invalidation_map=(Bit8u*)malloc(4096);
memset(invalidation_map,0,4096);
}
#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY)
#if !defined(C_UNALIGNED_MEMORY)
host_writed(&invalidation_map[addr],
host_readd(&invalidation_map[addr])+0x1010101);
#else
@ -672,6 +678,10 @@ static INLINE void cache_addq(Bit64u val) {
static void dyn_return(BlockReturn retcode,bool ret_exception);
static void dyn_run_code(void);
#ifdef WORDS_BIGENDIAN
static void cache_block_before_close(void);
static void cache_block_closing(const Bit8u* block_start,Bitu block_size);
#endif
/* Define temporary pagesize so the MPROTECT case and the regular case share as much code as possible */
#if (C_HAVE_MPROTECT)
@ -718,6 +728,9 @@ static void cache_init(bool enable) {
ret = sceKernelOpenVMDomain();
if (ret < 0) cache_code_start_ptr = NULL;
}
#elif defined(WIIU)
cache_code_start_ptr=(Bit8u*)WUP_RWX_MEM_BASE;
//memset(cache_code_start_ptr, 0, (WUP_RWX_MEM_END - WUP_RWX_MEM_BASE));
#else
cache_code_start_ptr=(Bit8u*)malloc(CACHE_TOTAL+CACHE_MAXSIZE+PAGESIZE_TEMP-1+PAGESIZE_TEMP);
#endif
@ -742,6 +755,7 @@ static void cache_init(bool enable) {
}
// setup the default blocks for block linkage returns
cache.pos=&cache_code_link_blocks[0];
#ifndef WORDS_BIGENDIAN
link_blocks[0].cache.start=cache.pos;
// link code that returns with a special return code
dyn_return(BR_Link1,false);
@ -756,6 +770,29 @@ static void cache_init(bool enable) {
// link_blocks[1].cache.start=cache.pos;
dyn_run_code();
#endif
#else
core_dynrec.runcode=(BlockReturn (*)(const Bit8u*))cache.pos;
// can use op to PAGESIZE_TEMP-64 bytes
dyn_run_code();
cache_block_before_close();
cache_block_closing(cache_code_link_blocks, cache.pos-cache_code_link_blocks);
cache.pos=&cache_code_link_blocks[PAGESIZE_TEMP-64];
link_blocks[0].cache.start=cache.pos;
// link code that returns with a special return code
// must be less than 32 bytes
dyn_return(BR_Link1,false);
cache_block_before_close();
cache_block_closing(link_blocks[0].cache.start, cache.pos-link_blocks[0].cache.start);
cache.pos=&cache_code_link_blocks[PAGESIZE_TEMP-32];
link_blocks[1].cache.start=cache.pos;
// link code that returns with a special return code
// must be less than 32 bytes
dyn_return(BR_Link2,false);
cache_block_before_close();
cache_block_closing(link_blocks[1].cache.start, cache.pos-link_blocks[1].cache.start);
#endif
cache.free_pages=0;
cache.last_page=0;
@ -793,6 +830,7 @@ static void cache_close(void) {
#elif defined (VITA)
sceKernelFreeMemBlock(sceBlock);
sceBlock = 0;
#elif defined(WIIU)
#else
free(cache_code_start_ptr);
#endif

View File

@ -409,7 +409,12 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
SetupCMDLine(pspseg,block);
};
CALLBACK_SCF(false); /* Carry flag cleared for caller if successfull */
if (flags==OVERLAY) return true; /* Everything done for overlays */
if (flags==OVERLAY) {
/* Changed registers */
reg_ax=0;
reg_dx=0;
return true; /* Everything done for overlays */
}
RealPt csip,sssp;
if (iscom) {
csip=RealMake(pspseg,0x100);
@ -422,7 +427,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
csip=RealMake(loadseg+head.initCS,head.initIP);
sssp=RealMake(loadseg+head.initSS,head.initSP);
if (head.initSP<4) LOG(LOG_EXEC,LOG_ERROR)("stack underflow/wrap at EXEC");
if ((pspseg+memsize)<(loadseg+head.initSS+(head.initSP>>4)))
if ((pspseg+memsize)<(RealSeg(sssp)+(RealOff(sssp)>>4)))
LOG(LOG_EXEC,LOG_ERROR)("stack outside memory block at EXEC");
}

View File

@ -128,7 +128,7 @@ static LoopHandler * loop;
bool SDLNetInited;
#endif
#if !defined(C_DBP_CUSTOMTIMING) || !defined(DBP_REMOVE_OLD_TIMING)
#ifndef C_DBP_CUSTOMTIMING
static Bit32u ticksRemain;
static Bit32u ticksLast;
static Bit32u ticksAdded;
@ -155,23 +155,9 @@ static Bitu Normal_Loop(void) {
#endif
} else {
#ifdef C_DBP_CUSTOMTIMING
extern bool dbp_new_timing;
if (dbp_new_timing)
{
static bool doTick;
if (doTick) {doTick=false;TIMER_AddTick();}
else {doTick=true;GFX_Events();return 0;}
}
#ifndef DBP_REMOVE_OLD_TIMING
else
{
GFX_Events();
if (ticksRemain>0) {
TIMER_AddTick();
ticksRemain--;
} else {increaseticks();return 0;}
}
#endif
#else
GFX_Events();
if (ticksRemain>0) {
@ -183,7 +169,7 @@ else
}
}
#if !defined(C_DBP_CUSTOMTIMING) || !defined(DBP_REMOVE_OLD_TIMING)
#ifndef C_DBP_CUSTOMTIMING
//For trying other delays
#ifdef C_DBP_USE_SDL
#define wrap_delay(a) SDL_Delay(a)
@ -386,7 +372,7 @@ static void DOSBOX_RealInit(Section * sec) {
Section_prop * section=static_cast<Section_prop *>(sec);
/* Initialize some dosbox internals */
#ifndef DBP_REMOVE_OLD_TIMING
#ifndef C_DBP_CUSTOMTIMING
ticksRemain=0;
ticksLast=GetTicks();
ticksLocked = false;
@ -874,20 +860,9 @@ void DBP_DOSBOX_ForceShutdown(const Bitu)
/* end all execution and return to the top of the stack */
struct ShutdownCPU { static Bitu Loop(void) { return 1; } };
DOSBOX_SetLoop(ShutdownCPU::Loop);
#if !defined(C_DBP_CUSTOMTIMING) || !defined(DBP_REMOVE_OLD_TIMING)
#ifndef C_DBP_CUSTOMTIMING
ticksRemain = 0;
#endif
CPU_CycleLeft = CPU_Cycles = 0;
first_shell->exit = true;
}
#ifndef DBP_REMOVE_OLD_TIMING
void DBP_DOSBOX_ResetTickTimer()
{
/* Reset any auto cycle guessing */
ticksLast = GetTicks();
ticksAdded = 0;
ticksDone = 0;
ticksScheduled = 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -171,6 +171,7 @@ struct Handler : public Adlib::Handler {
}
#define RAW_SIZE 1024
#endif /* C_DBP_ENABLE_OLDOPL */
@ -823,11 +824,8 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
//Used to be 2.0, which was measured to be too high. Exact value depends on card/clone.
mixerChan->SetScale( 1.5f );
if (oplemu == "fast") {
handler = new DBOPL::Handler();
}
#ifdef C_DBP_ENABLE_OLDOPL
else if (oplemu == "compat") {
if (oplemu == "compat") {
if ( oplmode == OPL_opl2 ) {
handler = new OPL2::Handler();
} else {
@ -842,14 +840,18 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
handler = new MAMEOPL3::Handler();
}
}
else
#endif
#ifdef C_DBP_ENABLE_NUKEDOPL3
else if (oplemu == "nuked") {
if (oplemu == "nuked") {
handler = new NukedOPL::Handler();
}
else
#endif
else {
handler = new DBOPL::Handler();
//Fall back to dbop, will also catch auto
if (oplemu == "fast" || 1) {
const bool opl3Mode = oplmode >= OPL_opl3;
handler = new DBOPL::Handler( opl3Mode );
}
handler->Init( rate );
bool single = false;

View File

@ -511,7 +511,7 @@ void Operator::WriteE0( const Chip* chip, Bit8u val ) {
if ( !(regE0 ^ val) )
return;
//in opl3 mode you can always selet 7 waveforms regardless of waveformselect
Bit8u waveForm = val & ( ( 0x3 & chip->waveFormMask ) | (0x7 & chip->opl3Active ) );
const Bit8u waveForm = val & ( ( 0x3 & chip->waveFormMask ) | (0x7 & chip->opl3Active ) );
regE0 = val;
#if ( DBOPL_WAVE == WAVE_HANDLER )
waveHandler = WaveHandlerTable[ waveForm ];
@ -975,7 +975,7 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) {
Chip
*/
Chip::Chip() {
Chip::Chip( bool _opl3Mode ) : opl3Mode( _opl3Mode ) {
reg08 = 0;
reg04 = 0;
regBD = 0;
@ -1113,7 +1113,8 @@ void Chip::WriteReg( Bit32u reg, Bit8u val ) {
switch ( (reg & 0xf0) >> 4 ) {
case 0x00 >> 4:
if ( reg == 0x01 ) {
waveFormMask = ( val & 0x20 ) ? 0x7 : 0x0;
//When the chip is running in opl3 compatible mode, you can't actually disable the waveforms
waveFormMask = ( (val & 0x20) || opl3Mode ) ? 0x7 : 0x0;
} else if ( reg == 0x104 ) {
//Only detect changes in lowest 6 bits
if ( !((reg104 ^ val) & 0x3f) )

View File

@ -198,7 +198,6 @@ struct Chip {
//This is used as the base counter for vibrato and tremolo
Bit32u lfoCounter;
Bit32u lfoAdd;
Bit32u noiseCounter;
Bit32u noiseAdd;
@ -226,6 +225,8 @@ struct Chip {
Bit8u waveFormMask;
//0 or -1 when enabled
Bit8s opl3Active;
//Running in opl3 mode
const bool opl3Mode;
//Return the maximum amount of samples before and LFO change
Bit32u ForwardLFO( Bit32u samples );
@ -244,7 +245,7 @@ struct Chip {
void Generate( Bit32u samples );
void Setup( Bit32u r );
Chip();
Chip( bool opl3Mode );
};
struct Handler : public Adlib::Handler {
@ -253,6 +254,9 @@ struct Handler : public Adlib::Handler {
virtual void WriteReg( Bit32u addr, Bit8u val );
virtual void Generate( MixerChannel* chan, Bitu samples );
virtual void Init( Bitu rate );
Handler(bool opl3Mode) : chip(opl3Mode) {
}
};

View File

@ -69,16 +69,7 @@
#define TICK_NEXT ( 1 << TICK_SHIFT)
#define TICK_MASK (TICK_NEXT -1)
#ifndef DBP_REMOVE_OLD_TIMING
#ifndef C_DBP_USE_SDL
extern bool dbp_new_timing;
void DBP_LockAudio();
void DBP_UnlockAudio();
#define SDL_LockAudio() (!dbp_new_timing ? DBP_LockAudio() : (void)0)
#define SDL_UnlockAudio() (!dbp_new_timing ? DBP_UnlockAudio() : (void)0)
#define SDL_PauseAudio(a)
#endif
#else
#define SDL_LockAudio()
#define SDL_UnlockAudio()
#define SDL_PauseAudio(a)

View File

@ -587,11 +587,11 @@ static Bitu INT8_Handler(void) {
#endif
mem_writed(BIOS_TIMER,value);
/* decrease floppy motor timer */
/* decrement FDD motor timeout counter; roll over on earlier PC, stop at zero on later PC */
Bit8u val = mem_readb(BIOS_DISK_MOTOR_TIMEOUT);
if (val) mem_writeb(BIOS_DISK_MOTOR_TIMEOUT,val-1);
/* and running drive */
mem_writeb(BIOS_DRIVE_RUNNING,mem_readb(BIOS_DRIVE_RUNNING) & 0xF0);
if (val || !IS_EGAVGA_ARCH) mem_writeb(BIOS_DISK_MOTOR_TIMEOUT,val-1);
/* clear FDD motor bits when counter reaches zero */
if (val == 1) mem_writeb(BIOS_DRIVE_RUNNING,mem_readb(BIOS_DRIVE_RUNNING) & 0xF0);
return CBRET_NONE;
}
#undef DOSBOX_CLOCKSYNC