Remove the global namespace a bit and remove some dead code.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7043 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-02-02 18:21:20 +00:00
parent 9a975705bf
commit 9c21d003af
67 changed files with 145 additions and 625 deletions

View File

@ -4,6 +4,4 @@ set(SRCS clrun/clrun.c
clrun/genclgl.c)
add_library(clrun STATIC ${SRCS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(clrun ${CMAKE_DL_LIBS})
endif()
target_link_libraries(clrun ${CMAKE_DL_LIBS})

View File

@ -86,7 +86,7 @@ namespace AudioCommon
soundStream = NULL;
}
NOTICE_LOG(DSPHLE, "Done shutting down sound stream");
INFO_LOG(DSPHLE, "Done shutting down sound stream");
}
std::vector<std::string> GetSoundBackends()

View File

@ -19,25 +19,19 @@
#include "CoreAudioSoundStream.h"
OSStatus callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList *ioData)
OSStatus CoreAudioSound::callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList *ioData)
{
for (UInt32 i = 0; i < ioData->mNumberBuffers; i++)
{
((CoreAudioSound *)inRefCon)-> \
RenderSamples(ioData->mBuffers[i].mData,
ioData->mBuffers[i].mDataByteSize);
}
((CoreAudioSound *)inRefCon)->m_mixer->
Mix((short *)ioData->mBuffers[i].mData,
ioData->mBuffers[i].mDataByteSize / 4);
return noErr;
}
void CoreAudioSound::RenderSamples(void *target, UInt32 size)
{
m_mixer->Mix((short *)target, size / 4);
}
CoreAudioSound::CoreAudioSound(CMixer *mixer) : SoundStream(mixer)
{
}

View File

@ -45,10 +45,14 @@ public:
virtual void Update();
void RenderSamples(void *target, UInt32 size);
private:
AudioUnit audioUnit;
static OSStatus callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList *ioData);
#else
public:
CoreAudioSound(CMixer *mixer) : SoundStream(mixer) {}

View File

@ -60,7 +60,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
#endif
}
void __cpuid(int info[4], int x)
static void __cpuid(int info[4], int x)
{
unsigned int eax = x, ebx = 0, ecx = 0, edx = 0;
do_cpuid(&eax, &ebx, &ecx, &edx);

View File

@ -47,7 +47,6 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
#include <byteswap.h>
#else
char * strndup(char const *s, size_t n);
size_t strnlen(const char *s, size_t n);
#endif
// go to debugger mode

View File

@ -89,22 +89,6 @@ u32 HashAdler32(const u8* data, size_t len)
return((b << 16) | a);
}
// Another fast and decent hash
u32 HashFNV(const u8* ptr, int length)
{
u32 hash = 0x811c9dc5;
for (int i = 0; i < length; i++)
{
hash *= 1677761;
hash ^= ptr[i];
}
return(hash);
}
// Stupid hash - but can't go back now :)
// Don't use for new things. At least it's reasonably fast.
u32 HashEctor(const u8* ptr, int length)

View File

@ -39,7 +39,7 @@ const char *GetLastErrorMsg()
#if !defined(__linux__) && !defined(_WIN32)
// strlen with cropping after size n
size_t strnlen(const char *s, size_t n)
static size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);

View File

@ -122,17 +122,6 @@ std::string StripQuotes(const std::string& s)
return s;
}
// "\"hello\"" is turned to "hello"
// This one assumes that the string has already been space stripped in both
// ends, as done by StripSpaces above, for example.
std::string StripNewline(const std::string& s)
{
if (s.size() && '\n' == *s.rbegin())
return s.substr(0, s.size() - 1);
else
return s;
}
bool TryParse(const std::string &str, u32 *const output)
{
char *endptr = NULL;
@ -201,13 +190,6 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
return true;
}
std::string PathToFilename(const std::string &Path)
{
std::string Name, Ending;
SplitPath(Path, 0, &Name, &Ending);
return Name + Ending;
}
void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename)
{
_CompleteFilename = _Path;

View File

@ -45,7 +45,6 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len = 20, bool spac
std::string StripSpaces(const std::string &s);
std::string StripQuotes(const std::string &s);
std::string StripNewline(const std::string &s);
// Thousand separator. Turns 12345678 into 12,345,678
template <typename I>
@ -92,8 +91,6 @@ void SplitString(const std::string& str, char delim, std::vector<std::string>& o
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
// "C:/Windows/winhelp.exe" to "winhelp.exe"
std::string PathToFilename(const std::string &Path);
void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);

View File

@ -29,8 +29,6 @@
namespace ActionReplay
{
int total;
// Alphanumeric filter for text<->bin conversion
const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS";

View File

@ -26,7 +26,7 @@
void bswap(Elf32_Word &w) {w = Common::swap32(w);}
void bswap(Elf32_Half &w) {w = Common::swap16(w);}
void byteswapHeader(Elf32_Ehdr &ELF_H)
static void byteswapHeader(Elf32_Ehdr &ELF_H)
{
bswap(ELF_H.e_type);
bswap(ELF_H.e_machine);
@ -43,7 +43,7 @@ void byteswapHeader(Elf32_Ehdr &ELF_H)
bswap(ELF_H.e_flags);
}
void byteswapSegment(Elf32_Phdr &sec)
static void byteswapSegment(Elf32_Phdr &sec)
{
bswap(sec.p_align);
bswap(sec.p_filesz);
@ -55,7 +55,7 @@ void byteswapSegment(Elf32_Phdr &sec)
bswap(sec.p_type);
}
void byteswapSection(Elf32_Shdr &sec)
static void byteswapSection(Elf32_Shdr &sec)
{
bswap(sec.sh_addr);
bswap(sec.sh_addralign);
@ -105,20 +105,6 @@ const char *ElfReader::GetSectionName(int section) const
return NULL;
}
void addrToHiLo(u32 addr, u16 &hi, s16 &lo)
{
lo = (addr & 0xFFFF);
u32 naddr = addr - lo;
hi = naddr>>16;
u32 test = (hi<<16) + lo;
if (test != addr)
{
Crash();
}
}
bool ElfReader::LoadInto(u32 vaddr)
{
DEBUG_LOG(MASTER_LOG,"String section: %i", header->e_shstrndx);

View File

@ -32,6 +32,7 @@ typedef int SectionID;
class ElfReader
{
private:
char *base;
u32 *base32;
@ -55,7 +56,10 @@ public:
ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); }
u32 GetEntryPoint() const { return entryPoint; }
u32 GetFlags() const { return (u32)(header->e_flags); }
bool LoadInto(u32 vaddr);
bool LoadSymbols();
private:
int GetNumSegments() const { return (int)(header->e_phnum); }
int GetNumSections() const { return (int)(header->e_shnum); }
const u8 *GetPtr(int offset) const { return (u8*)base + offset; }
@ -80,9 +84,6 @@ public:
bool DidRelocate() {
return bRelocate;
}
// More indepth stuff:)
bool LoadInto(u32 vaddr);
bool LoadSymbols();
};
#endif

View File

@ -209,7 +209,7 @@ void Stop() // - Hammertime!
// Video_EnterLoop() should now exit so that EmuThread() will continue
// concurrently with the rest of the commands in this function. We no
// longer rely on Postmessage.
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
g_video_backend->Video_ExitLoop();
// Wait until the CPU finishes exiting the main run loop
@ -386,9 +386,9 @@ void EmuThread()
}
// Wait for CpuThread to exit
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU-GPU thread ...").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU-GPU thread ...").c_str());
cpuRunloopQuit.Wait();
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
// On unix platforms, the Emulation main thread IS the CPU & video
// thread So there's only one thread, imho, that's much better than on
// windows :P
@ -396,7 +396,7 @@ void EmuThread()
}
// We have now exited the Video Loop
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Stop() and Video Loop Ended").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Stop() and Video Loop Ended").c_str());
// At this point, the CpuThread has already returned in SC mode.
// But it may still be waiting in Dual Core mode.
@ -415,11 +415,10 @@ void EmuThread()
// We must set up this flag before executing HW::Shutdown()
g_bHwInit = false;
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
HW::Shutdown();
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
WARN_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down plugins").c_str());
// In single core mode, this has already been called.
if (_CoreParameter.bCPUThread)
g_video_backend->Shutdown();
@ -427,10 +426,10 @@ void EmuThread()
Pad::Shutdown();
Wiimote::Shutdown();
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Plugins shutdown").c_str());
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Plugins shutdown").c_str());
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Main thread stopped").c_str());
NOTICE_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main thread stopped").c_str());
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
cpuRunloopQuit.Shutdown();
g_bStopping = false;
@ -614,7 +613,7 @@ bool report_slow(int skipped)
// Callback_VideoLog
// WARNING - THIS IS EXECUTED FROM VIDEO THREAD
void Callback_VideoLog(const char *_szMessage, int _bDoBreak)
void Callback_VideoLog(const char *_szMessage)
{
INFO_LOG(VIDEO, "%s", _szMessage);
}

View File

@ -34,7 +34,7 @@
namespace Core
{
void Callback_VideoLog(const char* _szMessage, int _bDoBreak);
void Callback_VideoLog(const char* _szMessage);
void Callback_VideoCopiedToXFB(bool video_update);
void Callback_VideoGetWindowSize(int& x, int& y, int& width, int& height);
void Callback_VideoRequestWindowSize(int& width, int& height);

View File

@ -39,7 +39,7 @@
#include <tmmintrin.h>
#endif
void gdsp_do_dma();
static void gdsp_do_dma();
Common::CriticalSection g_CriticalSection;
@ -246,7 +246,7 @@ u16 gdsp_ifx_read(u16 addr)
}
}
void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
{
UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
@ -268,8 +268,7 @@ void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
DSPAnalyzer::Analyze();
}
void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)
{
ERROR_LOG(DSPLLE, "*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)", dsp_addr / 2, addr, size);
}
@ -277,7 +276,7 @@ void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)
static const __m128i s_mask = _mm_set_epi32(0x0E0F0C0DL, 0x0A0B0809L, 0x06070405L, 0x02030001L);
// TODO: These should eat clock cycles.
void gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size)
{
u8* dst = ((u8*)g_dsp.dram);
@ -300,8 +299,7 @@ void gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size)
INFO_LOG(DSPLLE, "*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)", addr, dsp_addr / 2, size);
}
void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
{
const u8* src = ((const u8*)g_dsp.dram);
@ -325,7 +323,7 @@ void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
INFO_LOG(DSPLLE, "*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)", dsp_addr / 2, addr, size);
}
void gdsp_do_dma()
static void gdsp_do_dma()
{
u16 ctl;
u32 addr;

View File

@ -42,6 +42,4 @@ void gdsp_ifx_init();
void gdsp_ifx_write(u32 addr, u32 val);
u16 gdsp_ifx_read(u16 addr);
void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size);
#endif

View File

@ -26,7 +26,6 @@
u8 DSPHost_ReadHostMemory(u32 addr);
void DSPHost_WriteHostMemory(u8 value, u32 addr);
bool DSPHost_OnThread();
bool DSPHost_Running();
void DSPHost_InterruptRequest();
u32 DSPHost_CodeLoaded(const u8 *ptr, int size);
void DSPHost_UpdateDebugger();

View File

@ -30,14 +30,14 @@
// Stacks. The stacks are outside the DSP RAM, in dedicated hardware.
void dsp_reg_stack_push(int stack_reg)
static void dsp_reg_stack_push(int stack_reg)
{
g_dsp.reg_stack_ptr[stack_reg]++;
g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]] = g_dsp.r.st[stack_reg];
}
void dsp_reg_stack_pop(int stack_reg)
static void dsp_reg_stack_pop(int stack_reg)
{
g_dsp.r.st[stack_reg] = g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]];
g_dsp.reg_stack_ptr[stack_reg]--;

View File

@ -49,7 +49,6 @@ struct DSPState
Reset();
}
};
DSPState m_dspState;
void DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{

View File

@ -46,11 +46,6 @@ bool DSPHost_OnThread()
return _CoreParameter.bDSPThread;
}
bool DSPHost_Running()
{
return !(*PowerPC::GetStatePtr());
}
void DSPHost_InterruptRequest()
{
// Fire an interrupt on the PPC ASAP.

View File

@ -22,14 +22,15 @@
#define MAKE(type, arg) (*(type *)&(arg))
const u8 CEXIETHERNET::mac_address_default[6] = { 0x00, 0x09, 0xbf, 0x01, 0x00, 0xc1 };
CEXIETHERNET::CEXIETHERNET(const std::string& mac_addr) :
m_uPosition(0),
m_uCommand(0),
mWriteBuffer(2048),
mCbw(mBbaMem + CB_OFFSET, CB_SIZE)
{
const u8 mac_address_default[6] =
{ 0x00, 0x09, 0xbf, 0x01, 0x00, 0xc1 };
memset(mBbaMem, 0, BBA_MEM_SIZE);
int x = 0;

View File

@ -292,7 +292,6 @@ public:
volatile bool mWaiting;
static const u8 mac_address_default[6];
u8 mac_address[6];
u8 mRecvBuffer[BBA_RECV_SIZE];
#ifdef _WIN32

View File

@ -24,9 +24,6 @@
#include "EXI_Device.h"
#include "EXI_DeviceMic.h"
bool MicButton = false;
bool IsOpen;
// Unfortunately this must be enabled in Common.h for windows users. Scons should enable it otherwise
#if !HAVE_PORTAUDIO
@ -50,6 +47,9 @@ bool CEXIMic::IsInterruptSet(){return false;}
#pragma comment(lib, "C:/Users/Shawn/Desktop/portaudio/portaudio-v19/portaudio_x64.lib")
#endif
static bool MicButton = false;
static bool IsOpen;
union InputData
{
s16 word;

View File

@ -82,7 +82,7 @@ u8 *m_pRAM;
u8 *m_pL1Cache;
u8 *m_pEXRAM;
u8 *m_pFakeVMEM;
u8 *m_pEFB;
//u8 *m_pEFB;
// 64-bit: Pointers to high-mem mirrors
// 32-bit: Same as above
@ -92,7 +92,7 @@ u8 *m_pVirtualUncachedRAM;
u8 *m_pPhysicalEXRAM; // wii only
u8 *m_pVirtualCachedEXRAM; // wii only
u8 *m_pVirtualUncachedEXRAM; // wii only
u8 *m_pVirtualEFB;
//u8 *m_pVirtualEFB;
u8 *m_pVirtualL1Cache;
u8 *m_pVirtualFakeVMEM;

View File

@ -665,7 +665,9 @@ typedef struct tlb_entry
} tlb_entry;
// TODO: tlb needs to be in ppcState for save-state purposes.
tlb_entry tlb[NUM_TLBS][TLB_SIZE/TLB_WAYS][TLB_WAYS];
#ifdef FAST_TLB_CACHE
static tlb_entry tlb[NUM_TLBS][TLB_SIZE/TLB_WAYS][TLB_WAYS];
#endif
u32 LookupTLBPageAddress(const XCheckTLBFlag _Flag, const u32 vpa, u32 *paddr)
{

View File

@ -42,6 +42,7 @@ SRAM sram_dump = {{
0x00, 0x00
}};
#if 0
// german
SRAM sram_dump_german = {{
0x1F, 0x66,
@ -66,6 +67,7 @@ SRAM sram_dump_german = {{
0x00, 0x00,
0x00, 0x00
}};
#endif
void initSRAM()
{

View File

@ -43,7 +43,7 @@
#include "Attachment/Attachment.h"
/* Bit shift conversions */
u32 swap24(const u8* src)
static u32 swap24(const u8* src)
{
return (src[0] << 16) | (src[1] << 8) | src[2];
}

View File

@ -133,7 +133,7 @@ int FindWiimotes(Wiimote **wm, int max_wiimotes)
majorDeviceClass: kBluetoothDeviceClassMajorPeripheral
minorDeviceClass: kBluetoothDeviceClassMinorPeripheral2Joystick
];
[bti setUpdateNewDeviceNames: FALSE];
[bti setUpdateNewDeviceNames: NO];
if ([bti start] == kIOReturnSuccess)
[bti retain];

View File

@ -671,7 +671,7 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
}
u32 ParseCont(u8* pCont)
static u32 ParseCont(u8* pCont)
{
u32 attribOffset = 0;
CBigEndianBuffer attribList(pCont);

View File

@ -19,9 +19,7 @@
#include <vector>
#include "WiiMote_HID_Attr.h"
CAttribTable m_AttribTable;
#if 0
// 0x00 (checked)
u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 };
// 0x01 (checked)
@ -132,9 +130,10 @@ u8 HIDUnk_020C[] = { 0x09, 0x0c, 0x80 };
u8 HIDUnk_020D[] = { 0x28, 0x00 };
// 0x20e
u8 HIDBootDevice[] = { 0x28, 0x00 };
#endif
u8 packet1[] = {
static u8 packet1[] = {
0x00, 0x7b, 0x00, 0x76, 0x36, 0x01, 0xcc, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01,
0x00, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x11, 0x24, 0x09, 0x00, 0x04, 0x35, 0x0d, 0x35,
0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x11, 0x35, 0x03, 0x19, 0x00, 0x11, 0x09, 0x00, 0x05, 0x35,
@ -145,7 +144,7 @@ u8 packet1[] = {
0x20, 0x52, 0x56, 0x4c, 0x2d, 0x43, 0x4e, 0x54, 0x2d, 0x30, 0x31, 0x09, 0x01, 0x02, 0x00, 0x76,
};
u8 packet2[] = {
static u8 packet2[] = {
0x00, 0x7b, 0x00, 0x76, 0x01, 0x25, 0x13, 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e,
0x64, 0x6f, 0x20, 0x52, 0x56, 0x4c, 0x2d, 0x43, 0x4e, 0x54, 0x2d, 0x30, 0x31, 0x09, 0x01, 0x02,
0x25, 0x08, 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x6f, 0x09, 0x02, 0x00, 0x09, 0x01, 0x00,
@ -156,7 +155,7 @@ u8 packet2[] = {
0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00, 0x02, 0x00, 0xec,
};
u8 packet3[] = {
static u8 packet3[] = {
0x00, 0x7b, 0x00, 0x76, 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
@ -168,7 +167,7 @@ u8 packet3[] = {
0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00, 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x02, 0x01, 0x62,
};
u8 packet4[] = {
static u8 packet4[] = {
0x00, 0x70, 0x00, 0x6d, 0x81, 0x00, 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81,
0x00, 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81,
0x00, 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81,
@ -181,7 +180,7 @@ u8 packet4[] = {
};
u8 packet4_0x10001[] = {
static u8 packet4_0x10001[] = {
0x00, 0x60, 0x00, 0x5d, 0x36, 0x00, 0x5a, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01,
0x00, 0x01, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x12, 0x00, 0x09, 0x00, 0x04, 0x35, 0x0d, 0x35,
0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x00, 0x01, 0x09, 0x00, 0x05, 0x35,
@ -229,6 +228,10 @@ const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size)
return 0;
}
// XXX keep these?
#if 0
CAttribTable m_AttribTable;
void InitAttribTable()
{
m_AttribTable.push_back(SAttrib(0x00, ServiceRecordHandle, sizeof(ServiceRecordHandle)));
@ -270,4 +273,4 @@ const CAttribTable& GetAttribTable()
return m_AttribTable;
}
#endif

View File

@ -18,6 +18,7 @@
#ifndef WIIMOTE_HID_ATTR_H_
#define WIIMOTE_HID_ATTR_H_
#if 0
struct SAttrib
{
u16 ID;
@ -34,6 +35,7 @@ struct SAttrib
typedef std::vector<SAttrib> CAttribTable;
const CAttribTable& GetAttribTable();
#endif
const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size);

View File

@ -44,16 +44,8 @@ extern "C" {
// TODO Count: 7
#if defined(DEBUG) || defined(DEBUGFAST)
bool Debug = true;
#else
bool Debug = false;
#endif
namespace Lua {
int disableSound2, disableRamSearchUpdate;
bool BackgroundInput;
bool g_disableStatestateWarnings;
bool g_onlyCallSavestateCallbacks;
bool frameadvSkipLagForceDisable;
@ -168,11 +160,11 @@ static const char* luaMemHookTypeStrings [] =
};
//static const int _makeSureWeHaveTheRightNumberOfStrings2 [sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT ? 1 : 0];
void StopScriptIfFinished(int uid, bool justReturned = false);
void SetSaveKey(LuaContextInfo& info, const char* key);
void SetLoadKey(LuaContextInfo& info, const char* key);
void RefreshScriptStartedStatus();
void RefreshScriptSpeedStatus();
static void StopScriptIfFinished(int uid, bool justReturned = false);
static void SetSaveKey(LuaContextInfo& info, const char* key);
static void SetLoadKey(LuaContextInfo& info, const char* key);
static void RefreshScriptStartedStatus();
static void RefreshScriptSpeedStatus();
static char* rawToCString(lua_State* L, int idx=0);
static const char* toCString(lua_State* L, int idx=0);
@ -629,7 +621,7 @@ static const char* deferredGUIIDString = "lazygui";
// store the most recent C function call from Lua (and all its arguments)
// for later evaluation
void DeferFunctionCall(lua_State* L, const char* idstring)
static void DeferFunctionCall(lua_State* L, const char* idstring)
{
// there might be a cleaner way of doing this using lua_pushcclosure and lua_getref
@ -1118,7 +1110,7 @@ DEFINE_LUA_FUNCTION(emulua_wait, "")
return 0;
}
void indicateBusy(lua_State* L, bool busy)
static void indicateBusy(lua_State* L, bool busy)
{
// disabled because there have been complaints about this message being useless spam.
}
@ -1205,7 +1197,7 @@ void printfToOutput(const char* fmt, ...)
delete[] str;
}
bool FailVerifyAtFrameBoundary(lua_State* L, const char* funcName, int unstartedSeverity=2, int inframeSeverity=2)
static bool FailVerifyAtFrameBoundary(lua_State* L, const char* funcName, int unstartedSeverity=2, int inframeSeverity=2)
{
if (!Core::isRunning() || Core::GetState() == Core::CORE_STOPPING)
{
@ -1236,7 +1228,14 @@ bool FailVerifyAtFrameBoundary(lua_State* L, const char* funcName, int unstarted
}
// TODO
/*
#if 0
#if defined(DEBUG) || defined(DEBUGFAST)
static bool Debug = true;
#else
static bool Debug = false;
#endif
// acts similar to normal emulation update
// except without the user being able to activate emulator commands
DEFINE_LUA_FUNCTION(emulua_emulateframe, "")
@ -1352,7 +1351,8 @@ DEFINE_LUA_FUNCTION(emulua_speedmode, "mode")
info.speedMode = newSpeedMode;
RefreshScriptSpeedStatus();
return 0;
}*/
}
#endif
// I didn't make it clear enough what this function needs to do, so I'll spell it out this time:
@ -2146,7 +2146,7 @@ s_colorMapping [] =
{"magenta", 0xFF00FFFF},
};
inline int getcolor_unmodified(lua_State *L, int idx, int defaultColor)
static inline int getcolor_unmodified(lua_State *L, int idx, int defaultColor)
{
int type = lua_type(L,idx);
switch(type)
@ -2206,6 +2206,7 @@ inline int getcolor_unmodified(lua_State *L, int idx, int defaultColor)
}
return defaultColor;
}
int getcolor(lua_State *L, int idx, int defaultColor)
{
int color = getcolor_unmodified(L, idx, defaultColor);
@ -3046,7 +3047,7 @@ DEFINE_LUA_FUNCTION(input_getcurrentinputstatus, "")
// resets our "worry" counter of the Lua state
int dontworry(LuaContextInfo& info)
static int dontworry(LuaContextInfo& info)
{
if(info.stopWorrying)
{
@ -3665,7 +3666,7 @@ void RequestAbortLuaScript(int uid, const char* message)
}
}
void SetSaveKey(LuaContextInfo& info, const char* key)
static void SetSaveKey(LuaContextInfo& info, const char* key)
{
info.dataSaveKey = crc32(0, (const unsigned char*)key, (int)strlen(key));
@ -3675,7 +3676,8 @@ void SetSaveKey(LuaContextInfo& info, const char* key)
info.dataSaveLoadKeySet = true;
}
}
void SetLoadKey(LuaContextInfo& info, const char* key)
static void SetLoadKey(LuaContextInfo& info, const char* key)
{
info.dataLoadKey = crc32(0, (const unsigned char*)key, (int)strlen(key));
@ -4235,7 +4237,7 @@ void PushBinaryItem(T item, std::vector<unsigned char>& output)
}
// read a value from the byte stream and advance the stream by its size
template<typename T>
T AdvanceByteStream(const unsigned char*& data, unsigned int& remaining)
static T AdvanceByteStream(const unsigned char*& data, unsigned int& remaining)
{
#ifdef IS_LITTLE_ENDIAN
T rv = *(T*)data;
@ -4464,7 +4466,7 @@ static void LuaStackToBinaryConverter(lua_State* L, int i, std::vector<unsigned
// complements LuaStackToBinaryConverter
void BinaryToLuaStackConverter(lua_State* L, const unsigned char*& data, unsigned int& remaining)
static void BinaryToLuaStackConverter(lua_State* L, const unsigned char*& data, unsigned int& remaining)
{
assert(s_dbg_dataSize - (data - s_dbg_dataStart) == (int)remaining);
@ -4718,7 +4720,7 @@ void LuaSaveData::SaveRecordPartial(int uid, unsigned int key, int idx)
recordList = cur;
}
void fwriteint(unsigned int value, FILE* file)
static void fwriteint(unsigned int value, FILE* file)
{
for(int i=0;i<4;i++)
{
@ -4727,7 +4729,7 @@ void fwriteint(unsigned int value, FILE* file)
value >>= 8;
}
}
void freadint(unsigned int& value, FILE* file)
static void freadint(unsigned int& value, FILE* file)
{
int rv = 0;
for(int i=0;i<4;i++)
@ -4863,7 +4865,7 @@ void RestartAllLuaScripts()
}
// sets anything that needs to depend on the total number of scripts running
void RefreshScriptStartedStatus()
static void RefreshScriptStartedStatus()
{
int numScriptsStarted = 0;
@ -4882,7 +4884,7 @@ void RefreshScriptStartedStatus()
}
// sets anything that needs to depend on speed mode or running status of scripts
void RefreshScriptSpeedStatus()
static void RefreshScriptSpeedStatus()
{
g_anyScriptsHighSpeed = false;
@ -4898,6 +4900,4 @@ void RefreshScriptSpeedStatus()
}
}
};

View File

@ -31,7 +31,6 @@ namespace Frame {
bool g_bFrameStep = false;
bool g_bFrameStop = false;
u32 g_rerecords = 0;
bool g_bFirstKey = true;
PlayMode g_playMode = MODE_NONE;
unsigned int g_framesToSkip = 0, g_frameSkipCounter = 0;

View File

@ -65,7 +65,7 @@ const u32 MASKS = 0x1F80; // mask away the interrupts.
const u32 DAZ = 0x40;
const u32 FTZ = 0x8000;
void FPSCRtoFPUSettings(UReg_FPSCR fp)
static void FPSCRtoFPUSettings(UReg_FPSCR fp)
{
// Set FPU rounding mode to mimic the PowerPC's
#ifdef _M_IX86
@ -239,7 +239,7 @@ void Interpreter::mtmsr(UGeckoInstruction _inst)
// Segment registers. MMU control.
void SetSR(int index, u32 value) {
static void SetSR(int index, u32 value) {
DEBUG_LOG(POWERPC, "%08x: MMU: Segment register %i set to %08x", PowerPC::ppcState.pc, index, value);
PowerPC::ppcState.sr[index] = value;
}
@ -341,16 +341,16 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
old_hid0.Hex = oldValue;
if (HID0.ICE != old_hid0.ICE)
{
NOTICE_LOG(POWERPC, "Instruction Cache Enable (HID0.ICE) = %d", (int)HID0.ICE);
INFO_LOG(POWERPC, "Instruction Cache Enable (HID0.ICE) = %d", (int)HID0.ICE);
}
if (HID0.ILOCK != old_hid0.ILOCK)
{
NOTICE_LOG(POWERPC, "Instruction Cache Lock (HID0.ILOCK) = %d", (int)HID0.ILOCK);
INFO_LOG(POWERPC, "Instruction Cache Lock (HID0.ILOCK) = %d", (int)HID0.ILOCK);
}
if (HID0.ICFI)
{
HID0.ICFI = 0;
NOTICE_LOG(POWERPC, "Flush Instruction Cache! ICE=%d", (int)HID0.ICE);
INFO_LOG(POWERPC, "Flush Instruction Cache! ICE=%d", (int)HID0.ICE);
// this is rather slow
// most games do it only once during initialization
PowerPC::ppcState.iCache.Reset();

View File

@ -71,6 +71,7 @@ protected:
X64CachedReg saved_xregs[NUMXREGS];
virtual const int *GetAllocationOrder(int &count) = 0;
int SanityCheck() const;
XEmitter *emit;
@ -95,7 +96,6 @@ public:
}
virtual void Flush(FlushMode mode);
virtual void Flush(PPCAnalyst::CodeOp *op) {Flush(FLUSH_ALL);}
int SanityCheck() const;
void KillImmediate(int preg, bool doLoad, bool makeDirty);
//TODO - instead of doload, use "read", "write"

View File

@ -571,12 +571,11 @@ public:
IRBuilder() { Reset(); }
unsigned getNumberOfOperands(InstLoc I) const;
private:
IRBuilder(IRBuilder&); // DO NOT IMPLEMENT
unsigned isSameValue(InstLoc Op1, InstLoc Op2) const;
unsigned getComplexity(InstLoc I) const;
unsigned getNumberOfOperands(InstLoc I) const;
void simplifyCommutative(unsigned Opcode, InstLoc& Op1, InstLoc& Op2);
bool maskedValueIsZero(InstLoc Op1, InstLoc Op2) const;
InstLoc isNeg(InstLoc I) const;

View File

@ -39,7 +39,8 @@ using namespace Gen;
extern u8 *trampolineCodePtr;
void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) {
#ifdef _M_X64
static void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) {
u64 code_addr = (u64)codePtr;
disassembler disasm;
char disbuf[256];
@ -55,7 +56,7 @@ void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) {
text.c_str(), emAddress, disbuf, code_addr);
return;
}
#endif
void TrampolineCache::Init()
{

View File

@ -436,11 +436,3 @@ void UpdateFPRF(double dvalue)
//if (FPSCR.FPRF == 0x11)
// PanicAlert("QNAN alert");
}
void UpdateFEX() {
FPSCR.FEX = (FPSCR.XX & FPSCR.XE) |
(FPSCR.ZX & FPSCR.ZE) |
(FPSCR.UX & FPSCR.UE) |
(FPSCR.OX & FPSCR.OE) |
(FPSCR.VX & FPSCR.VE);
}

View File

@ -508,7 +508,7 @@ void State_Shutdown()
}
}
std::string MakeStateFilename(int state_number)
static std::string MakeStateFilename(int state_number)
{
return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), state_number);
}

View File

@ -127,7 +127,7 @@ void FindFilename(u64 offset)
FileAccess = false;
ReadGC(SConfig::GetInstance().m_LastFilename);
ISOFile = SConfig::GetInstance().m_LastFilename;
NOTICE_LOG(FILEMON, "Opening '%s'", ISOFile.c_str());
INFO_LOG(FILEMON, "Opening '%s'", ISOFile.c_str());
return;
}

View File

@ -68,7 +68,7 @@ private:
const unsigned char g_MasterKey[16] = {0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4,0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7};
const unsigned char g_MasterKeyK[16] = {0x63,0xb8,0x2b,0xb4,0xf4,0x61,0x4e,0x2e,0x13,0xf2,0xfe,0xfb,0xba,0x4c,0x9b,0x7e};
IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum, bool Korean);
static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum, bool Korean);
EDiscType GetDiscType(IBlobReader& _rReader);
IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum)
@ -142,7 +142,7 @@ bool IsVolumeWadFile(const IVolume *_rVolume)
return (Common::swap32(MagicWord) == 0x00204973 || Common::swap32(MagicWord) == 0x00206962);
}
IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum, bool Korean)
static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum, bool Korean)
{
CBlobBigEndianReader Reader(_rReader);

View File

@ -181,8 +181,8 @@ private:
wxRadioBox* DSPEngine;
wxSlider* VolumeSlider;
wxStaticText* VolumeText;
wxCheckBox* EnableDTKMusic;
wxCheckBox* EnableThrottle;
wxCheckBox* EnableDTKMusic;
wxCheckBox* EnableThrottle;
wxArrayString wxArrayBackends;
wxChoice* BackendSelection;
wxChoice* FrequencySelection;
@ -278,7 +278,6 @@ private:
void OnSpin(wxSpinEvent& event);
void AudioSettingsChanged(wxCommandEvent& event);
bool SupportsVolumeChanges(std::string backend);
void AddAudioBackends();
void GCSettingsChanged(wxCommandEvent& event);
@ -295,6 +294,9 @@ private:
void DVDRootChanged(wxFileDirPickerEvent& event);
void ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event));
private:
DECLARE_EVENT_TABLE();
static bool SupportsVolumeChanges(std::string backend);
};
#endif

View File

@ -229,10 +229,14 @@ void CFrame::CreateMenu()
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _("Show &Statusbar"));
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _("Show &Logwindow"));
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _("Show &Log"));
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _("Show &Console"));
viewMenu->AppendSeparator();
#ifndef _WIN32
viewMenu->Enable(IDM_CONSOLEWINDOW, false);
#endif
if (g_pCodeWindow)
{
viewMenu->Check(IDM_LOGWINDOW, g_pCodeWindow->bShowOnStart[0]);

View File

@ -304,15 +304,18 @@ bool DolphinApp::OnInit()
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight;
// The following is not needed in linux. Linux window managers do not allow windows to
// be created off the desktop.
// The following is not needed with X11, where window managers
// do not allow windows to be created off the desktop.
#ifdef _WIN32
// Out of desktop check
HWND hDesktop = GetDesktopWindow();
RECT rc;
GetWindowRect(hDesktop, &rc);
if (rc.right < x + w || rc.bottom < y + h)
x = y = -1;
x = y = wxDefaultCoord;
#elif defined __APPLE__
if (y < 1)
y = wxDefaultCoord;
#endif
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY,
@ -412,11 +415,6 @@ void DolphinApp::InitLanguageSupport()
}
}
void DolphinApp::OnEndSession()
{
SConfig::GetInstance().SaveSettings();
}
int DolphinApp::OnExit()
{
WiimoteReal::Shutdown();

View File

@ -29,7 +29,6 @@ public:
private:
bool OnInit();
void OnEndSession();
int OnExit();
void OnFatalException();
void InitLanguageSupport();

View File

@ -274,7 +274,7 @@ void CMemcardManager::CreateGUIControls()
void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event))
{
Destroy();
Close();
}
void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)

View File

@ -17,10 +17,7 @@
#include "GCMemcard.h"
#include "ColorUtil.h"
// i think there is support for this stuff in the common lib... if not there should be support
// undefined functions... prolly it means something like that
void ByteSwap(u8 *valueA, u8 *valueB)
static void ByteSwap(u8 *valueA, u8 *valueB)
{
u8 tmp = *valueA;
*valueA = *valueB;

View File

@ -34,7 +34,6 @@ set(SRCS Src/BPFunctions.cpp
Src/VertexShaderManager.cpp
Src/VideoConfig.cpp
Src/VideoState.cpp
Src/XFBConvert.cpp
Src/XFMemory.cpp
Src/XFStructs.cpp
Src/memcpy_amd.cpp)

View File

@ -25,7 +25,6 @@
#include "HW/Memmap.h"
#include "ConfigManager.h"
bool textureChanged[8];
const bool renderFog = false;
namespace BPFunctions
{

View File

@ -27,7 +27,6 @@
#include "HW/Memmap.h"
volatile bool g_bSkipCurrentFrame = false;
volatile bool g_EFBAccessRequested = false;
extern u8* g_pVideoData;
namespace
@ -79,20 +78,9 @@ void Fifo_SetRendering(bool enabled)
g_bSkipCurrentFrame = !enabled;
}
// Executed from another thread, no the graphics thread!
// Basically, all it does is set a flag so that the loop will eventually exit, then
// waits for the event to be set, which happens when the loop does exit.
// If we look stuck in here, then the video thread is stuck in something and won't exit
// the loop. Switch to the video thread and investigate.
void Fifo_ExitLoop()
{
Fifo_ExitLoopNonBlocking();
EmuRunning = true;
}
// May be executed from any thread, even the graphics thread.
// Created to allow for self shutdown.
void Fifo_ExitLoopNonBlocking()
void Fifo_ExitLoop()
{
// This should break the wait loop in CPU thread
CommandProcessor::fifo.bFF_GPReadEnable = false;

View File

@ -36,7 +36,6 @@ void Fifo_SendFifoData(u8* _uData, u32 len);
// These two are for dual core mode only.
void Fifo_EnterLoop();
void Fifo_ExitLoop();
void Fifo_ExitLoopNonBlocking();
void Fifo_RunLoop(bool run);
bool AtBreakpoint();
void Fifo_DoState(PointerWrap &f);

View File

@ -213,7 +213,7 @@ bool FifoCommandRunnable()
"* Some other sort of bug\n\n"
"Dolphin will now likely crash or hang. Enjoy." , cmd_byte);
Host_SysMessage(szTemp);
Core::Callback_VideoLog(szTemp, true);
Core::Callback_VideoLog(szTemp);
{
SCPFifoStruct &fifo = CommandProcessor::fifo;
@ -238,7 +238,7 @@ bool FifoCommandRunnable()
,fifo.bFF_Breakpoint ? "true" : "false");
Host_SysMessage(szTmp);
Core::Callback_VideoLog(szTmp, true);
Core::Callback_VideoLog(szTmp);
}
}
break;

View File

@ -39,7 +39,6 @@ files = [
'VertexShaderManager.cpp',
'VideoConfig.cpp',
'VideoState.cpp',
'XFBConvert.cpp',
'XFMemory.cpp',
'XFStructs.cpp',
'memcpy_amd.cpp',

View File

@ -181,14 +181,14 @@ int TexDecoder_GetPaletteSize(int format)
}
}
inline u32 decodeIA8(u16 val)
static inline u32 decodeIA8(u16 val)
{
int a = val >> 8;
int i = val & 0xFF;
return (a << 24) | (i << 16) | (i << 8) | i;
}
inline u32 decode5A3(u16 val)
static inline u32 decode5A3(u16 val)
{
int r,g,b,a;
if ((val & 0x8000))
@ -208,7 +208,7 @@ inline u32 decode5A3(u16 val)
return (a << 24) | (r << 16) | (g << 8) | b;
}
inline u32 decode5A3RGBA(u16 val)
static inline u32 decode5A3RGBA(u16 val)
{
int r,g,b,a;
if ((val&0x8000))
@ -228,7 +228,7 @@ inline u32 decode5A3RGBA(u16 val)
return r | (g<<8) | (b << 16) | (a << 24);
}
inline u32 decode565RGBA(u16 val)
static inline u32 decode565RGBA(u16 val)
{
int r,g,b,a;
r=Convert5To8((val>>11) & 0x1f);
@ -238,7 +238,7 @@ inline u32 decode565RGBA(u16 val)
return r | (g<<8) | (b << 16) | (a << 24);
}
inline u32 decodeIA8Swapped(u16 val)
static inline u32 decodeIA8Swapped(u16 val)
{
int a = val & 0xFF;
int i = val >> 8;

View File

@ -1,292 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#if _WIN32
#include <intrin.h>
#endif
#include "OpenCL.h"
#include <xmmintrin.h>
#include "XFBConvert.h"
#include "Common.h"
namespace {
const __m128i _bias1 = _mm_set_epi32(128/2 << 16, 0, 128/2 << 16, 16 << 16);
const __m128i _bias2 = _mm_set_epi32(128/2 << 16, 16 << 16, 128/2 << 16, 0);
__m128i _y[256];
__m128i _u[256];
__m128i _v[256];
__m128i _r1[256];
__m128i _r2[256];
__m128i _g1[256];
__m128i _g2[256];
__m128i _b1[256];
__m128i _b2[256];
} // namespace
bool Inited = false;
cl_kernel To_kernel;
cl_program To_program;
cl_kernel From_kernel;
cl_program From_program;
const char *__ConvertFromXFB = "int bound(int i) \n \
{ \n \
return (i>255)?255:((i<0)?0:i); \n \
} \n \
\n \
void yuv2rgb(int y, int u, int v, int &r, int &g, int &b) \n \
{ \n \
b = bound((76283*(y - 16) + 132252*(u - 128))>>16); \n \
g = bound((76283*(y - 16) - 53281 *(v - 128) - 25624*(u - 128))>>16); //last one u? \n \
r = bound((76283*(y - 16) + 104595*(v - 128))>>16); \n \
} \n \
\n \
void ConvertFromXFB(u32 *dst, const u8* _pXFB) \n \
{ \n \
const unsigned char *src = _pXFB; \n \
int id = get_global_id(0); \n \
int srcOffset = id * 4; \n \
int dstOffset = id; \n \
u32 numBlocks = (width * height) / 2; \n \
\n \
int Y1 = src[srcOffset]; \n \
int U = src[srcOffset + 1]; \n \
int Y2 = src[srcOffset + 2]; \n \
int V = src[srcOffset + 3]; \n \
\n \
int r, g, b; \n \
yuv2rgb(Y1,U,V, r,g,b); \n \
dst[dstOffset] = 0xFF000000 | (r<<16) | (g<<8) | (b); \n \
yuv2rgb(Y2,U,V, r,g,b); \n \
dst[dstOffset + 1] = 0xFF000000 | (r<<16) | (g<<8) | (b); \n \
} \n";
const char *__ConvertToXFB = "__kernel void ConvertToXFB(__global unsigned int *dst, __global const unsigned char* _pEFB) \n \
{ \n \
const unsigned char *src = _pEFB;\n \
int id = get_global_id(0);\n \
int srcOffset = id * 8; \n \
\n \
int y1 = (((16843 * src[srcOffset]) + (33030 * src[srcOffset + 1]) + (6423 * src[srcOffset + 2])) >> 16) + 16; \n \
int u1 = ((-(9699 * src[srcOffset]) - (19071 * src[srcOffset + 1]) + (28770 * src[srcOffset + 2])) >> 16) + 128;\n \
srcOffset += 4;\n \
\n \
int y2 = (((16843 * src[srcOffset]) + (33030 * src[srcOffset + 1]) + (6423 * src[srcOffset + 2])) >> 16) + 16;\n \
int v2 = (((28770 * src[srcOffset]) - (24117 * src[srcOffset + 1]) - (4653 * src[srcOffset + 2])) >> 16) + 128;\n \
\n \
dst[id] = (v2 << 24) | (y2 << 16) | (u1 << 8) | (y1); \n \
} \n ";
void InitKernels()
{
From_program = OpenCL::CompileProgram(__ConvertFromXFB);
From_kernel = OpenCL::CompileKernel(From_program, "ConvertFromXFB");
To_program = OpenCL::CompileProgram(__ConvertToXFB);
To_kernel = OpenCL::CompileKernel(To_program, "ConvertToXFB");
Inited = true;
}
void InitXFBConvTables()
{
for (int i = 0; i < 256; i++)
{
_y[i] = _mm_set_epi32(0xFFFFFFF, 76283*(i - 16), 76283*(i - 16), 76283*(i - 16));
_u[i] = _mm_set_epi32( 0, 0, -25624 * (i - 128), 132252 * (i - 128));
_v[i] = _mm_set_epi32( 0, 104595 * (i - 128), -53281 * (i - 128), 0);
_r1[i] = _mm_add_epi32(_mm_set_epi32( 28770 * i / 2, 0, -9699 * i / 2, 16843 * i),
_bias1);
_g1[i] = _mm_set_epi32(-24117 * i / 2, 0, -19071 * i / 2, 33030 * i);
_b1[i] = _mm_set_epi32( -4653 * i / 2, 0, 28770 * i / 2, 6423 * i);
_r2[i] = _mm_add_epi32(_mm_set_epi32( 28770 * i / 2, 16843 * i, -9699 * i / 2, 0),
_bias2);
_g2[i] = _mm_set_epi32(-24117 * i / 2, 33030 * i, -19071 * i / 2, 0);
_b2[i] = _mm_set_epi32( -4653 * i / 2, 6423 * i, 28770 * i / 2, 0);
}
}
void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height)
{
if (((size_t)dst & 0xF) != 0) {
PanicAlert("ConvertFromXFB - unaligned destination");
}
const unsigned char *src = _pXFB;
u32 numBlocks = ((width * height) / 2) / 2;
if(!Inited)
InitKernels();
int err;
size_t global = 0; // global domain size for our calculation
size_t local = 0; // local domain size for our calculation
printf("width %d, height %d\n", width, height);
// Create the input and output arrays in device memory for our calculation
//
cl_mem _dst = clCreateBuffer(OpenCL::g_context, CL_MEM_WRITE_ONLY, sizeof(unsigned int) * numBlocks, NULL, NULL);
if (!dst)
{
printf("Error: Failed to allocate device memory!\n");
exit(1);
}
cl_mem _src = clCreateBuffer(OpenCL::g_context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(unsigned char) * width * height, (void*)_pXFB, NULL);
if (!src)
{
printf("Error: Failed to allocate device memory!\n");
exit(1);
}
// Set the arguments to our compute kernel
//
err = 0;
err = clSetKernelArg(From_kernel, 0, sizeof(cl_mem), &_dst);
err |= clSetKernelArg(From_kernel, 1, sizeof(cl_mem), &_src);
if (err != CL_SUCCESS)
{
printf("Error: Failed to set kernel arguments! %d\n", err);
exit(1);
}
// Get the maximum work group size for executing the kernel on the device
//
err = clGetKernelWorkGroupInfo(From_kernel, OpenCL::device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &local, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to retrieve kernel work group info! %d\n", err);
local = 64;
}
// Execute the kernel over the entire range of our 1d input data set
// using the maximum number of work group items for this device
//
global = numBlocks;
if(global < local)
{
// Global can't be less than local
}
err = clEnqueueNDRangeKernel(OpenCL::g_cmdq, From_kernel, 1, NULL, &global, &local, 0, NULL, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to execute kernel! %d\n", err);
return;
}
// Wait for the command commands to get serviced before reading back results
//
clFinish(OpenCL::g_cmdq);
// Read back the results from the device to verify the output
//
err = clEnqueueReadBuffer( OpenCL::g_cmdq, _dst, CL_TRUE, 0, sizeof(unsigned int) * numBlocks, dst, 0, NULL, NULL );
if (err != CL_SUCCESS)
{
printf("Error: Failed to read output array! %d\n", err);
exit(1);
}
clReleaseMemObject(_dst);
clReleaseMemObject(_src);
}
void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height)
{
const unsigned char *src = _pEFB;
u32 numBlocks = ((width * height) / 2) / 4;
if (((size_t)dst & 0xF) != 0) {
PanicAlert("ConvertToXFB - unaligned XFB");
}
if(!Inited)
InitKernels();
int err;
size_t global = 0; // global domain size for our calculation
size_t local = 0; // local domain size for our calculation
printf("width %d, height %d\n", width, height);
// Create the input and output arrays in device memory for our calculation
//
cl_mem _dst = clCreateBuffer(OpenCL::g_context, CL_MEM_WRITE_ONLY, sizeof(unsigned int) * numBlocks, NULL, NULL);
if (!dst)
{
printf("Error: Failed to allocate device memory!\n");
exit(1);
}
cl_mem _src = clCreateBuffer(OpenCL::g_context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(unsigned char) * width * height, (void*)_pEFB, NULL);
if (!src)
{
printf("Error: Failed to allocate device memory!\n");
exit(1);
}
// Set the arguments to our compute kernel
//
err = 0;
err = clSetKernelArg(To_kernel, 0, sizeof(cl_mem), &_dst);
err |= clSetKernelArg(To_kernel, 1, sizeof(cl_mem), &_src);
if (err != CL_SUCCESS)
{
printf("Error: Failed to set kernel arguments! %d\n", err);
exit(1);
}
// Get the maximum work group size for executing the kernel on the device
//
err = clGetKernelWorkGroupInfo(To_kernel, OpenCL::device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &local, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to retrieve kernel work group info! %d\n", err);
local = 64;
}
// Execute the kernel over the entire range of our 1d input data set
// using the maximum number of work group items for this device
//
global = numBlocks;
if(global < local)
{
// Global can't be less than local
}
err = clEnqueueNDRangeKernel(OpenCL::g_cmdq, To_kernel, 1, NULL, &global, &local, 0, NULL, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to execute kernel! %d\n", err);
return;
}
// Wait for the command commands to get serviced before reading back results
//
clFinish(OpenCL::g_cmdq);
// Read back the results from the device to verify the output
//
err = clEnqueueReadBuffer( OpenCL::g_cmdq, _dst, CL_TRUE, 0, sizeof(unsigned int) * numBlocks, dst, 0, NULL, NULL );
if (err != CL_SUCCESS)
{
printf("Error: Failed to read output array! %d\n", err);
exit(1);
}
clReleaseMemObject(_dst);
clReleaseMemObject(_src);
}

View File

@ -1,39 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _XFB_CONVERT
#define _XFB_CONVERT
#include "Common.h"
// This must be called once before calling the two conversion functions
// below.
void InitXFBConvTables();
// These implementations could likely be made considerably faster by
// reducing precision so that intermediate calculations are done in
// 15-bit precision instead of 32-bit. However, this would complicate
// the code and since we have a GPU implementation too, there really
// isn't much point.
// Converts 4:2:2 YUV (YUYV) data to 32-bit RGBA data.
void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height);
// Converts 32-bit RGBA data to 4:2:2 YUV (YUYV) data.
void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height);
#endif

View File

@ -593,30 +593,6 @@
RelativePath=".\Src\VideoState.h"
>
</File>
<File
RelativePath=".\Src\XFBConvert.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\XFBConvert.h"
>
</File>
</Filter>
<Filter
Name="Vertex Loading"

View File

@ -271,7 +271,6 @@
<ClCompile Include="Src\VertexShaderManager.cpp" />
<ClCompile Include="Src\VideoConfig.cpp" />
<ClCompile Include="Src\VideoState.cpp" />
<ClCompile Include="Src\XFBConvert.cpp" />
<ClCompile Include="Src\XFMemory.cpp" />
<ClCompile Include="Src\XFStructs.cpp" />
</ItemGroup>
@ -318,7 +317,6 @@
<ClInclude Include="Src\VideoCommon.h" />
<ClInclude Include="Src\VideoConfig.h" />
<ClInclude Include="Src\VideoState.h" />
<ClInclude Include="Src\XFBConvert.h" />
<ClInclude Include="Src\XFMemory.h" />
<ClInclude Include="Src\XFStructs.h" />
</ItemGroup>

View File

@ -47,9 +47,6 @@
<ClCompile Include="Src\VideoState.cpp">
<Filter>Util</Filter>
</ClCompile>
<ClCompile Include="Src\XFBConvert.cpp">
<Filter>Util</Filter>
</ClCompile>
<ClCompile Include="Src\PixelShaderManager.cpp">
<Filter>Shader Managers</Filter>
</ClCompile>
@ -174,9 +171,6 @@
<ClInclude Include="Src\VideoState.h">
<Filter>Util</Filter>
</ClInclude>
<ClInclude Include="Src\XFBConvert.h">
<Filter>Util</Filter>
</ClInclude>
<ClInclude Include="Src\PixelShaderManager.h">
<Filter>Shader Managers</Filter>
</ClInclude>

View File

@ -25,7 +25,6 @@
u8 DSPHost_ReadHostMemory(u32 addr) { return 0; }
void DSPHost_WriteHostMemory(u8 value, u32 addr) {}
bool DSPHost_OnThread() { return false; }
bool DSPHost_Running() { return true; }
u32 DSPHost_CodeLoaded(const u8 *ptr, int size) {return 0x1337c0de;}
void DSPHost_InterruptRequest() {}
void DSPHost_UpdateDebugger() {}

View File

@ -29,7 +29,6 @@
#include "VideoConfig.h"
#include "VertexLoaderManager.h"
#include "VertexShaderManager.h"
#include "XFBConvert.h"
#include "Core.h"
#include "DebuggerPanel.h"
@ -174,7 +173,6 @@ void VideoBackend::Initialize()
InitBackendInfo();
frameCount = 0;
InitXFBConvTables();
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());

View File

@ -49,7 +49,6 @@
#include "D3DUtil.h"
#include "EmuWindow.h"
#include "VideoState.h"
#include "XFBConvert.h"
#include "render.h"
#include "DLCache.h"
#include "IniFile.h"
@ -155,7 +154,6 @@ void VideoBackend::Initialize()
InitBackendInfo();
frameCount = 0;
InitXFBConvTables();
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());

View File

@ -30,7 +30,7 @@ if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LIBS ${LIBS} Cg CgGL)
endif()
if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LIBS ${LIBS} clrun)
endif()

View File

@ -83,7 +83,6 @@ Make AA apply instantly during gameplay if possible
#include "PixelShaderManager.h"
#include "VertexShaderCache.h"
#include "VertexShaderManager.h"
#include "XFBConvert.h"
#include "CommandProcessor.h"
#include "PixelEngine.h"
#include "TextureConverter.h"
@ -98,9 +97,6 @@ Make AA apply instantly during gameplay if possible
#include "VideoBackend.h"
#include "ConfigManager.h"
// Logging
int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
namespace OGL
{
@ -166,7 +162,6 @@ void VideoBackend::Initialize()
InitBackendInfo();
frameCount = 0;
InitXFBConvTables();
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());

View File

@ -80,25 +80,6 @@ void OpenGL_SetWindowText(const char *text)
#endif
}
// Draw messages on top of the screen
unsigned int Callback_PeekMessages()
{
#ifdef _WIN32
// TODO: peekmessage
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return FALSE;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return TRUE;
#else
return FALSE;
#endif
}
// Show the current FPS
void UpdateFPSDisplay(const char *text)
{

View File

@ -94,9 +94,6 @@ void StringTests()
{
EXPECT_EQ(StripSpaces(" abc "), "abc");
EXPECT_EQ(StripNewline(" abc \n"), " abc ");
EXPECT_EQ(StripNewline(" abc \n "), " abc \n ");
EXPECT_EQ(StripQuotes("\"abc\""), "abc");
EXPECT_EQ(StripQuotes("\"abc\" "), "\"abc\" ");