Permalink
Browse files

Merge branch 'sync-upstream'

  • Loading branch information...
littleguy77 committed Jun 7, 2015
2 parents 8edc767 + 2f7cca8 commit c6964988acfb5048ad87066bd8ff352c90d12459
@@ -38,6 +38,7 @@
#include "main.h"
#include "memory/memory.h"
#include "osal/preproc.h"
#include "r4300/r4300_core.h"
#include "rom.h"
#define __STDC_FORMAT_MACROS
@@ -80,11 +81,14 @@ static unsigned char read_address_8bit(unsigned int address)
static void update_address_16bit(unsigned int address, unsigned short new_value)
{
*(unsigned short *)(((unsigned char*)g_rdram + ((address & 0xFFFFFF)^S16))) = new_value;
address &= 0xfeffffff; // mask out bit 24 which is used by GS codes to specify 8/16 bits
invalidate_r4300_cached_code(address, 2);
}
static void update_address_8bit(unsigned int address, unsigned char new_value)
{
*(unsigned char *)(((unsigned char*)g_rdram + ((address & 0xFFFFFF)^S8))) = new_value;
invalidate_r4300_cached_code(address, 1);
}
static int address_equal_to_8bit(unsigned int address, unsigned char value)
@@ -57,6 +57,8 @@
#define SDL_SetEventFilter(func, data) SDL_SetEventFilter(func)
#define event_sdl_filter(userdata, event) event_sdl_filter(const event)
#else
SDL_JoystickID l_iJoyInstanceID[10];
#endif
#define M64P_CORE_PROTOTYPES 1
@@ -161,6 +163,9 @@ static int MatchJoyCommand(const SDL_Event *event, eJoyCommand cmd)
return 0;
if (sscanf(event_str, "J%dA%d%c", &dev_number, &input_number, &axis_direction) != 3)
return 0;
#if SDL_VERSION_ATLEAST(2,0,0)
dev_number = l_iJoyInstanceID[dev_number];
#endif
if (dev_number != event->jaxis.which || input_number != event->jaxis.axis)
return 0;
if (axis_direction == '+')
@@ -199,6 +204,9 @@ static int MatchJoyCommand(const SDL_Event *event, eJoyCommand cmd)
return 0;
if (sscanf(event_str, "J%dH%dV%d", &dev_number, &input_number, &input_value) != 3)
return 0;
#if SDL_VERSION_ATLEAST(2,0,0)
dev_number = l_iJoyInstanceID[dev_number];
#endif
if (dev_number != event->jhat.which || input_number != event->jhat.hat)
return 0;
if ((event->jhat.value & input_value) == input_value && JoyCmdActive[cmd] == 0)
@@ -219,6 +227,9 @@ static int MatchJoyCommand(const SDL_Event *event, eJoyCommand cmd)
return 0;
if (sscanf(event_str, "J%dB%d", &dev_number, &input_number) != 2)
return 0;
#if SDL_VERSION_ATLEAST(2,0,0)
dev_number = l_iJoyInstanceID[dev_number];
#endif
if (dev_number != event->jbutton.which || input_number != event->jbutton.button)
return 0;
if (event->type == SDL_JOYBUTTONDOWN && JoyCmdActive[cmd] == 0)
@@ -368,7 +379,8 @@ void event_initialize(void)
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_JoystickOpen(device);
SDL_Joystick *thisJoy = SDL_JoystickOpen(device);
l_iJoyInstanceID[device] = SDL_JoystickInstanceID(thisJoy);
#else
if (!SDL_JoystickOpened(device))
SDL_JoystickOpen(device);
@@ -210,14 +210,18 @@ memory_map = restore_candidate + 512
dyna_linker:
/* r0 = virtual target address */
/* r1 = instruction to patch */
ldr r4, .tlbptr
ldr r4, .tlbptr_offset1
.tlbptr_lpic1:
add r4, pc, r4
lsr r5, r0, #12
mov r12, r0
cmp r0, #0xC0000000
mov r6, #4096
ldrge r12, [r4, r5, lsl #2]
mov r2, #0x80000
ldr r3, .jiptr
ldr r3, .jiptr_offset1
.jiptr_lpic1:
add r3, pc, r3
tst r12, r12
sub r6, r6, #1
moveq r12, r0
@@ -257,10 +261,14 @@ dyna_linker:
.A3:
/* hash_table lookup */
cmp r2, #2048
ldr r3, .jdptr
ldr r3, .jdptr_offset1
.jdptr_lpic1:
add r3, pc, r3
eor r4, r0, r0, lsl #16
lslcc r2, r0, #9
ldr r6, .htptr
ldr r6, .htptr_offset1
.htptr_lpic1:
add r6, pc, r6
lsr r4, r4, #12
lsrcc r2, r2, #21
bic r4, r4, #15
@@ -300,6 +308,27 @@ dyna_linker:
/* pagefault */
mov r1, r0
mov r2, #8
.jiptr_align1:
.align 2
.jiptr_offset1:
.word jump_in-(.jiptr_lpic1+8)
.jdptr_align1:
.align 2
.jdptr_offset1:
.word jump_dirty-(.jdptr_lpic1+8)
.tlbptr_align1:
.align 2
.tlbptr_offset1:
.word tlb_LUT_r-(.tlbptr_lpic1+8)
.htptr_align1:
.align 2
.htptr_offset1:
.word hash_table-(.htptr_lpic1+8)
.size dyna_linker, .-dyna_linker
.type exec_pagefault, %function
exec_pagefault:
@@ -333,14 +362,18 @@ exec_pagefault:
dyna_linker_ds:
/* r0 = virtual target address */
/* r1 = instruction to patch */
ldr r4, .tlbptr
ldr r4, .tlbptr_offset2
.tlbptr_lpic2:
add r4, pc, r4
lsr r5, r0, #12
mov r12, r0
cmp r0, #0xC0000000
mov r6, #4096
ldrge r12, [r4, r5, lsl #2]
mov r2, #0x80000
ldr r3, .jiptr
ldr r3, .jiptr_offset2
.jiptr_lpic2:
add r3, pc, r3
tst r12, r12
sub r6, r6, #1
moveq r12, r0
@@ -380,10 +413,14 @@ dyna_linker_ds:
.B3:
/* hash_table lookup */
cmp r2, #2048
ldr r3, .jdptr
ldr r3, .jdptr_offset2
.jdptr_lpic2:
add r3, pc, r3
eor r4, r0, r0, lsl #16
lslcc r2, r0, #9
ldr r6, .htptr
ldr r6, .htptr_offset2
.htptr_lpic2:
add r6, pc, r6
lsr r4, r4, #12
lsrcc r2, r2, #21
bic r4, r4, #15
@@ -427,15 +464,29 @@ dyna_linker_ds:
mov r2, #0x80000008 /* High bit set indicates pagefault in delay slot */
sub r0, r1, #4
b exec_pagefault
.jiptr_align2:
.align 2
.jiptr_offset2:
.word jump_in-(.jiptr_lpic2+8)
.jdptr_align2:
.align 2
.jdptr_offset2:
.word jump_dirty-(.jdptr_lpic2+8)
.tlbptr_align2:
.align 2
.tlbptr_offset2:
.word tlb_LUT_r-(.tlbptr_lpic2+8)
.htptr_align2:
.align 2
.htptr_offset2:
.word hash_table-(.htptr_lpic2+8)
.size dyna_linker_ds, .-dyna_linker_ds
.jiptr:
.word jump_in
.jdptr:
.word jump_dirty
.tlbptr:
.word tlb_LUT_r
.htptr:
.word hash_table
.align 2
.global jump_vaddr_r0
.hidden jump_vaddr_r0
@@ -535,7 +586,9 @@ jump_vaddr_r7:
.hidden jump_vaddr
.type jump_vaddr, %function
jump_vaddr:
ldr r1, .htptr
ldr r1, .htptr_offset3
.htptr_lpic3:
add r1, pc, r1
mvn r3, #15
and r2, r3, r2, lsr #12
ldr r2, [r1, r2]!
@@ -548,6 +601,12 @@ jump_vaddr:
bl get_addr
ldr r10, [fp, #cycle_count-dynarec_local]
mov pc, r0
.htptr_align3:
.align 2
.htptr_offset3:
.word hash_table-(.htptr_lpic3+8)
.size jump_vaddr, .-jump_vaddr
.align 2
.global verify_code_ds
@@ -796,8 +855,12 @@ jump_eret:
.hidden new_dyna_start
.type new_dyna_start, %function
new_dyna_start:
ldr r12, .dlptr
ldr r1, .tgtptr
ldr r12, .dlptr_offset
.dlptr_lpic:
add r12, pc, r12
ldr r1, .tgtptr_offset
.tgtptr_lpic:
add r1, pc, r1
mov r0, #0xa4000000
stmia r12, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
sub fp, r12, #28
@@ -809,11 +872,19 @@ new_dyna_start:
str r0, [fp, #last_count-dynarec_local]
sub r10, r10, r0
mov pc, r4
.dlptr:
.word dynarec_local+28
.tgtptr:
.word out
.dlptr_align:
.align 2
.dlptr_offset:
.word dynarec_local+28-(.dlptr_lpic+8)
.tgtptr_align:
.align 2
.tgtptr_offset:
.word out-(.tgtptr_lpic+8)
.size new_dyna_start, .-new_dyna_start
.align 2
.global invalidate_addr_r0
.hidden invalidate_addr_r0
@@ -117,7 +117,7 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
_pTexture->mirrorT = 0;
_pTexture->realWidth = _pTexture->width;
_pTexture->realHeight = _pTexture->height;
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * sizeof(float);
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * fboFormats.depthFormatBytes;
textureCache().addFrameBufferTextureSize(_pTexture->textureBytes);
#ifdef GL_MULTISAMPLING_SUPPORT
@@ -140,9 +140,9 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
{
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
if (_pBuffer != NULL)
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT_FORMAT, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, 0, GL_DEPTH_COMPONENT, DEPTH_COMPONENT_TYPE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL);
else
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT_FORMAT, video().getWidth(), video().getHeight(), 0, GL_DEPTH_COMPONENT, DEPTH_COMPONENT_TYPE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, video().getWidth(), video().getHeight(), 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -72,15 +72,4 @@ extern const GLuint depthImageUnit;
void DepthBuffer_Init();
void DepthBuffer_Destroy();
#ifdef GLES2
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT
#define DEPTH_COMPONENT_TYPE GL_UNSIGNED_INT
#elif defined (GLES3) || defined (GLES3_1)
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT32F
#define DEPTH_COMPONENT_TYPE GL_FLOAT
#else
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT
#define DEPTH_COMPONENT_TYPE GL_FLOAT
#endif
#endif
Oops, something went wrong.

0 comments on commit c696498

Please sign in to comment.