Permalink
Browse files

Merge pull request #484 from fzurita/master

Update to the latest GLideN64
  • Loading branch information...
xperia64 committed Oct 11, 2015
2 parents 0b588c3 + ea4fb15 commit b0bc5bf2bc7dc31f5efa790ccca6b86f0b0e388f
@@ -33,6 +33,14 @@ Good_Name=Bakushou Jinsei 64 - Mezase! Resort Ou (J)
Good_Name=Banjo-Kazooie (E)(U) / Banjo To Kazooie No Daibouken (J)
frameBufferEmulation\copyToRDRAM=1
[BANJO%20KAZOOIE%202]
Good_Name=Banjo to Kazooie no Daibouken 2 (J)
frameBufferEmulation\copyToRDRAM=1
[BANJO%20TOOIE]
Good_Name=Banjo-Tooie (E)(U)
frameBufferEmulation\copyToRDRAM=1
[BEETLE%20ADVENTURE%20RAC]
Good_Name=Beetle Adventure Racing (E)(U)
frameBufferEmulation\copyToRDRAM=1
@@ -54,6 +62,7 @@ frameBufferEmulation\detectCFB=1
[52150A67]
Good_Name=Bokujou Monogatari 2 (J)
frameBufferEmulation\N64DepthCompare=1
[476C09C1]
Good_Name=Bomberman Hero - Mirian Oujo Wo Sukue! (J)
@@ -99,11 +108,13 @@ frameBufferEmulation\copyDepthToRDRAM=1
Good_Name=Donkey Kong 64 (E)(J)(U)
frameBufferEmulation\copyToRDRAM=1
frameBufferEmulation\detectCFB=1
frameBufferEmulation\copyDepthToRDRAM=1
[D%20K%20DISPLAY]
Good_Name=Donkey Kong 64 Kiosk Demo (U)
frameBufferEmulation\copyToRDRAM=1
frameBufferEmulation\detectCFB=1
frameBufferEmulation\copyDepthToRDRAM=1
[72390C86]
Good_Name=Doraemon - Nobita To 3tsu No Seireiseki (J)
@@ -121,6 +132,9 @@ frameBufferEmulation\copyFromRDRAM=1
[67000C2B]
Good_Name=Eikou No Saint Andrews (J)
[EXCITEBIKE64]
frameBufferEmulation\copyDepthToRDRAM=1
[EXTREME_G]
Good_Name=Extreme-G (E)
frameBufferEmulation\N64DepthCompare=1
@@ -250,6 +264,7 @@ frameBufferEmulation\copyToRDRAM=1
[MICKEY%20USA]
Good_Name=Mickey's Speedway USA (U) / Mickey No Racing Challenge USA (J)
frameBufferEmulation\copyToRDRAM=1
frameBufferEmulation\copyDepthToRDRAM=1
[293D0695]
Good_Name=Morita Shougi 64 (J)
@@ -336,6 +351,9 @@ Good_Name=Super Robot Taisen 64 (J)
[622D0C12]
Good_Name=Susume! Taisen Puzzle Dama - Toukon! Marutama Chou (J)
[TWISTED%20EDGE]
frameBufferEmulation\copyDepthToRDRAM=1
[ZELDA%20MAJORA%27S%20MASK]
Good_Name=The Legend Of Zelda - Majora's Mask (E)(U) / Zelda No Densetsu - Mujura No Karmen (J)
frameBufferEmulation\copyToRDRAM=1
@@ -47,6 +47,28 @@ set(GLideN64_SOURCES
common/CommonAPIImpl_common.cpp
)
#check if we're running on Raspberry Pi
MESSAGE("Looking for bcm_host.h")
if(EXISTS "/opt/vc/include/bcm_host.h")
MESSAGE("bcm_host.h found")
set(BCMHOST ON)
set(GLES2 ON)
add_definitions(
-DVC
)
include_directories(
"/opt/vc/include"
"/opt/vc/include/interface/vcos"
"/opt/vc/include/interface/vmcs_host/linux"
"/opt/vc/include/interface/vcos/pthreads"
)
link_directories(
"/opt/vc/lib"
)
else(EXISTS "/opt/vc/include/bcm_host.h")
MESSAGE("bcm_host.h not found")
endif(EXISTS "/opt/vc/include/bcm_host.h")
if(MUPENPLUSAPI)
add_definitions(
-DMUPENPLUSAPI
@@ -128,7 +150,11 @@ if(PANDORA)
)
endif(PANDORA)
SET( ENV{FREETYPE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../freetype )
if(BCMHOST)
SET( FREETYPE_INCLUDE_DIRS "/usr/include/freetype2/" )
else(BCMHOST)
SET( ENV{FREETYPE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../freetype )
endif(BCMHOST)
FIND_PACKAGE( Freetype REQUIRED )
include_directories( ${FREETYPE_INCLUDE_DIRS} )
@@ -176,10 +202,15 @@ else(GLES2)
endif(GLES2)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x -static-libgcc -static-libstdc++")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" )
SET(GCC_STATIC_LINK_FLAGS "-static-libgcc -static-libstdc++")
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_STATIC_LINK_FLAGS}" )
#check for G++ 4.8+
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE G++_VERSION)
if (G++_VERSION VERSION_LESS 4.8)
message(SEND_ERROR "You need at least G++ 4.8 to compile GLideN64!")
endif()
SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x -static-libgcc -static-libstdc++")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" )
SET(GCC_STATIC_LINK_FLAGS "-static-libgcc -static-libstdc++")
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_STATIC_LINK_FLAGS}" )
endif()
add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES})
@@ -212,7 +243,6 @@ if( CMAKE_BUILD_TYPE STREQUAL "Release")
if(SDL)
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} osal GLideNHQ )
else(SDL)
target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} osal GLideNHQ )
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} osal GLideNHQ )
endif(SDL)
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
@@ -97,7 +97,13 @@ void CombinerInfo::init()
{
m_pCurrent = NULL;
m_pUniformCollection = createUniformCollection();
m_bShaderCacheSupported = config.generalEmulation.enableShadersStorage != 0 && OGLVideo::isExtensionSupported(GET_PROGRAM_BINARY_EXTENSION);
GLint numBinaryFormats = 0;
#ifdef GL_NUM_PROGRAM_BINARY_FORMATS
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &numBinaryFormats);
#endif
m_bShaderCacheSupported = config.generalEmulation.enableShadersStorage != 0 &&
OGLVideo::isExtensionSupported(GET_PROGRAM_BINARY_EXTENSION) &&
numBinaryFormats > 0;
m_shadersLoaded = 0;
if (m_bShaderCacheSupported && !_loadShadersStorage()) {
@@ -12,7 +12,7 @@ void Config::resetToDefaults()
{
version = CONFIG_VERSION_CURRENT;
#ifdef PANDORA
#if defined(PANDORA) || defined(VC)
video.fullscreen = 1;
video.fullscreenWidth = video.windowedWidth = 800;
#else
@@ -42,10 +42,14 @@ void Config::resetToDefaults()
generalEmulation.polygonOffsetUnits = 0.0f;
#endif
#ifdef VC
frameBufferEmulation.enable = 0;
#else
frameBufferEmulation.enable = 1;
frameBufferEmulation.copyDepthToRDRAM = 0;
#endif
frameBufferEmulation.copyDepthToRDRAM = ctDisable;
frameBufferEmulation.copyFromRDRAM = 0;
frameBufferEmulation.copyToRDRAM = 1;
frameBufferEmulation.copyToRDRAM = ctSync;
frameBufferEmulation.detectCFB = 0;
frameBufferEmulation.N64DepthCompare = 0;
frameBufferEmulation.aspect = 1;
@@ -63,6 +63,12 @@ struct Config
aTotal = 4
};
enum CopyToRDRAM {
ctDisable = 0,
ctSync,
ctAsync
};
struct {
u32 enable;
u32 copyToRDRAM;
@@ -23,8 +23,10 @@ class FrameBufferToRDRAM
{
public:
FrameBufferToRDRAM() :
m_FBO(0), m_PBO(0), m_pTexture(NULL)
{}
m_bSync(true), m_FBO(0), m_pTexture(NULL), m_curIndex(0)
{
m_aPBO[0] = m_aPBO[1] = 0;
}
void Init();
void Destroy();
@@ -39,9 +41,11 @@ class FrameBufferToRDRAM
u32 raw;
};
bool m_bSync;
GLuint m_FBO;
GLuint m_PBO;
CachedTexture * m_pTexture;
u32 m_curIndex;
GLuint m_aPBO[2];
};
class DepthBufferToRDRAM
@@ -924,10 +928,14 @@ void FrameBufferToRDRAM::Init()
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
// Generate and initialize Pixel Buffer Objects
glGenBuffers(1, &m_PBO);
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_PBO);
glGenBuffers(2, m_aPBO);
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_aPBO[0]);
glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, NULL, GL_DYNAMIC_READ);
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_aPBO[1]);
glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, NULL, GL_DYNAMIC_READ);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
m_bSync = config.frameBufferEmulation.copyToRDRAM == Config::ctSync;
m_curIndex = 0;
}
void FrameBufferToRDRAM::Destroy() {
@@ -940,10 +948,8 @@ void FrameBufferToRDRAM::Destroy() {
textureCache().removeFrameBufferTexture(m_pTexture);
m_pTexture = NULL;
}
if (m_PBO != 0) {
glDeleteBuffers(1, &m_PBO);
m_PBO = 0;
}
glDeleteBuffers(2, m_aPBO);
m_aPBO[0] = m_aPBO[1] = 0;
}
void FrameBufferToRDRAM::CopyToRDRAM(u32 _address)
@@ -979,14 +985,17 @@ void FrameBufferToRDRAM::CopyToRDRAM(u32 _address)
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
glReadBuffer(GL_COLOR_ATTACHMENT0);
#ifndef GLES2
PBOBinder binder(GL_PIXEL_PACK_BUFFER, m_PBO);
// If Sync, read pixels from the buffer, copy them to RDRAM.
// If not Sync, read pixels from the buffer, copy pixels from the previous buffer to RDRAM.
m_curIndex ^= 1;
const u32 nextIndex = m_bSync ? m_curIndex : m_curIndex^1;
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_aPBO[m_curIndex]);
glReadPixels(0, 0, VI.width, VI.height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
PBOBinder binder(GL_PIXEL_PACK_BUFFER, m_aPBO[nextIndex]);
GLubyte* pixelData = (GLubyte*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, numPixels * 4, GL_MAP_READ_BIT);
if(pixelData == NULL)
return;
#else
m_curIndex = 0;
const u32 nextIndex = 0;
GLubyte* pixelData = (GLubyte* )malloc(numPixels * 4);
if(pixelData == NULL)
return;
@@ -20,11 +20,11 @@ set(GLideNHQ_SOURCES
TxUtil.cpp
)
if(PANDORA)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../osal )
else(PANDORA)
include_directories( inc ${CMAKE_CURRENT_SOURCE_DIR}/../osal )
endif(PANDORA)
if(PANDORA OR BCMHOST)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../osal )
else(PANDORA OR BCMHOST)
include_directories( inc ${CMAKE_CURRENT_SOURCE_DIR}/../osal )
endif(PANDORA OR BCMHOST)
LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/lib )
if(UNIX)
@@ -90,10 +90,21 @@ if( NOT GHQCHK )
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1)
target_link_libraries(GLideNHQd PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a
${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a
)
if(BCMHOST)
FIND_PACKAGE( ZLIB REQUIRED )
FIND_PACKAGE( PNG REQUIRED )
target_link_libraries(GLideNHQd
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
osald
)
else(BCMHOST)
target_link_libraries(GLideNHQd PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a
${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a
osald
)
endif(BCMHOST)
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
if( CMAKE_BUILD_TYPE STREQUAL "Release")
@@ -106,14 +117,24 @@ if( NOT GHQCHK )
if(PANDORA)
target_link_libraries(GLideNHQ PRIVATE
/mnt/utmp/codeblocks/usr/lib/libpng.a
/mnt/utmp/codeblocks/usr/lib/libz.a
)
/mnt/utmp/codeblocks/usr/lib/libpng.a
/mnt/utmp/codeblocks/usr/lib/libz.a
osal
)
elseif(BCMHOST)
FIND_PACKAGE( ZLIB REQUIRED )
FIND_PACKAGE( PNG REQUIRED )
target_link_libraries(GLideNHQ
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
osal
)
else(PANDORA)
target_link_libraries(GLideNHQ PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a
${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a
)
${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a
${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a
osal
)
endif(PANDORA)
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
else( NOT GHQCHK )
@@ -137,3 +158,4 @@ else( NOT GHQCHK )
target_link_libraries(ghqchk ${OPENGL_LIBRARIES} png z )
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
endif( NOT GHQCHK )
@@ -115,7 +115,17 @@ void ConfigDialog::_init()
ui->customSettingsCheckBox->setChecked(config.generalEmulation.enableCustomSettings != 0);
ui->frameBufferGroupBox->setChecked(config.frameBufferEmulation.enable != 0);
ui->copyFrameCheckBox->setChecked(config.frameBufferEmulation.copyToRDRAM != 0);
switch (config.frameBufferEmulation.copyToRDRAM) {
case Config::ctDisable:
ui->copyBufferDisableRadioButton->setChecked(true);
break;
case Config::ctSync:
ui->copyBufferSyncRadioButton->setChecked(true);
break;
case Config::ctAsync:
ui->copyBufferAsyncRadioButton->setChecked(true);
break;
}
ui->RenderFBCheckBox->setChecked(config.frameBufferEmulation.copyFromRDRAM != 0);
ui->detectCPUWritesCheckBox->setChecked(config.frameBufferEmulation.detectCFB != 0);
ui->CopyDepthCheckBox->setChecked(config.frameBufferEmulation.copyDepthToRDRAM != 0);
@@ -285,7 +295,12 @@ void ConfigDialog::accept()
config.generalEmulation.enableCustomSettings = ui->customSettingsCheckBox->isChecked() ? 1 : 0;
config.frameBufferEmulation.enable = ui->frameBufferGroupBox->isChecked() ? 1 : 0;
config.frameBufferEmulation.copyToRDRAM = ui->copyFrameCheckBox->isChecked() ? 1 : 0;
if (ui->copyBufferDisableRadioButton->isChecked())
config.frameBufferEmulation.copyToRDRAM = Config::ctDisable;
else if (ui->copyBufferSyncRadioButton->isChecked())
config.frameBufferEmulation.copyToRDRAM = Config::ctSync;
else if (ui->copyBufferAsyncRadioButton->isChecked())
config.frameBufferEmulation.copyToRDRAM = Config::ctAsync;
config.frameBufferEmulation.copyFromRDRAM = ui->RenderFBCheckBox->isChecked() ? 1 : 0;
config.frameBufferEmulation.detectCFB = ui->detectCPUWritesCheckBox->isChecked() ? 1 : 0;
config.frameBufferEmulation.copyDepthToRDRAM = ui->CopyDepthCheckBox->isChecked() ? 1 : 0;
@@ -78,7 +78,7 @@ void _loadSettings(QSettings & settings)
config.font.color[0] = fontColor.red();
config.font.color[1] = fontColor.green();
config.font.color[2] = fontColor.blue();
config.font.color[4] = fontColor.alpha();
config.font.color[3] = fontColor.alpha();
config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8);
config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8);
config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8);
Oops, something went wrong.

0 comments on commit b0bc5bf

Please sign in to comment.