diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index b09570283d..cd77d37346 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -201,23 +201,3 @@ std::string CPUInfo::Summarize() if (bLongMode) sum += ", 64-bit support"; return sum; } - -// Turn the cpu info into a string we can show(This version uses headings and line breaks) -std::string CPUInfo::Summarize_long() -{ - std::string sum; - sum = StringFromFormat("CPU Brand: %s\n",cpu_string); - - sum += StringFromFormat("Number of cores: %i \n ",num_cores); - - sum+= "Supported instruction sets:\n"; - - if (bSSE) sum += " -SSE\n"; - if (bSSE2) sum += " -SSE2\n"; - if (bSSE3) sum += " -SSE3\n"; - if (bSSSE3) sum += " -SSSE3\n"; - if (bSSE4_1) sum += " -SSE4.1\n"; - if (bSSE4_2) sum += " -SSE4.2\n"; - if (bLongMode) sum += "64-bit supported"; - return sum; -} \ No newline at end of file diff --git a/Source/Core/Common/Src/CPUDetect.h b/Source/Core/Common/Src/CPUDetect.h index 7d3796f5a8..55a0de93c9 100644 --- a/Source/Core/Common/Src/CPUDetect.h +++ b/Source/Core/Common/Src/CPUDetect.h @@ -58,9 +58,6 @@ struct CPUInfo // Turn the cpu info into a string we can show std::string Summarize(); - - // Turn the cpu info into a string we can show(This version uses headings and line breaks) - std::string Summarize_long(); }; extern CPUInfo cpu_info; diff --git a/Source/Core/Common/Src/ConsoleListener.cpp b/Source/Core/Common/Src/ConsoleListener.cpp index c987f3c441..87f69c86e9 100644 --- a/Source/Core/Common/Src/ConsoleListener.cpp +++ b/Source/Core/Common/Src/ConsoleListener.cpp @@ -251,14 +251,6 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool #endif } -void ConsoleListener::CustomLog(const char *Text) -{ - #ifdef _WIN32 - DWORD cCharsWritten; - WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL); - #endif -} - void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) { #if defined(_WIN32) diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index e6772b9535..232bf6901f 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -83,7 +83,6 @@ public: #ifdef _WIN32 COORD GetCoordinates(int BytesRead, int BufferWidth); #endif - void CustomLog(const char *Text); void Log(LogTypes::LOG_LEVELS, const char *Text); void ClearScreen(bool Cursor = true); diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index dd7452590e..7a752960a1 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -51,7 +51,7 @@ enum ZCODE_END = 0x00, ZCODE_NORM = 0x02, ZCODE_ROW = 0x03, - ZCODE_04 = 0x04, + ZCODE_MEM_COPY = 0x04, // Conditonal Codes CONDTIONAL_IF_EQUAL = 0x01, @@ -227,17 +227,16 @@ void LogInfo(const char *format, ...) void RunAllActive() { - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats) - { + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats) { for (std::vector::iterator i = activeCodes.begin(); i != activeCodes.end(); ++i) { if (i->active) { - i->active = RunCode(*i); + if (!RunCode(*i)) + i->active = false; LogInfo("\n"); } } - if (!b_RanOnce) b_RanOnce = true; } @@ -293,18 +292,16 @@ bool RunCode(const ARCode &arcode) { LogInfo("Command: %08x", cmd); // Do Fill & Slide - if (doFillNSlide) - { + if (doFillNSlide) { doFillNSlide = false; LogInfo("Doing Fill And Slide"); if (!ZeroCode_FillAndSlide(val_last, addr, data)) return false; continue; - } + } // Memory Copy - if (doMemoryCopy) - { + if (doMemoryCopy) { doMemoryCopy = false; LogInfo("Doing Memory Copy"); if (!ZeroCode_MemoryCopy(val_last, addr, data)) @@ -313,8 +310,7 @@ bool RunCode(const ARCode &arcode) { } // ActionReplay program self modification codes - if (addr >= 0x00002000 && addr < 0x00003000) - { + if (addr >= 0x00002000 && addr < 0x00003000) { LogInfo("This action replay simulator does not support codes that modify Action Replay itself."); PanicAlert("This action replay simulator does not support codes that modify Action Replay itself."); return false; @@ -343,7 +339,7 @@ bool RunCode(const ARCode &arcode) { LogInfo("ZCode: Executes all codes in the same row, Set register 1BB4 to 1 (zcode not supported)"); PanicAlert("Zero 3 code not supported"); return false; - case ZCODE_04: // Fill & Slide or Memory Copy + case ZCODE_MEM_COPY: // Fill & Slide or Memory Copy if (((addr >> 25) & 0x03) == 0x3) { LogInfo("ZCode: Memory Copy"); @@ -558,7 +554,7 @@ bool Subtype_WriteToPointer(u32 addr, u32 data) bool Subtype_AddCode(u32 addr, u32 data) { // Used to incrment a value in memory - u32 new_addr = (addr & 0x81FFFFFF); + u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000; u8 size = (addr >> 25) & 0x03; LogInfo("Hardware Address: %08x", new_addr); LogInfo("Size: %08x", size); @@ -589,15 +585,12 @@ bool Subtype_AddCode(u32 addr, u32 data) { LogInfo("32-bit floating Add"); LogInfo("--------"); - - u32 read = Memory::Read_U32(new_addr); - float fread = *((float*)&read); - fread += (float)data; - u32 newval = *((u32*)&fread); - Memory::Write_U32(newval, new_addr); - LogInfo("Old Value %08x", read); - LogInfo("Increment %08x", data); - LogInfo("New value %08x", newval); + union conv {float x; u32 y;}; + conv c1; + c1.y = Memory::Read_U32(new_addr); + c1.x += (float)data; + Memory::Write_U32((u32)c1.x, new_addr); + LogInfo("Wrote %08x to address %08x", (u32)c1.x, new_addr); LogInfo("--------"); break; } @@ -622,7 +615,7 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX(u32 addr, u32 data) bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing { - u32 new_addr = (val_last & 0x81FFFFFF); + u32 new_addr = (val_last & 0x01FFFFFF) | 0x80000000; u8 size = (val_last >> 25) & 0x03; s16 addr_incr = (s16)(data & 0xFFFF); s8 val_incr = (s8)((data & 0xFF000000) >> 24); diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index e013f90f93..698e03ea4a 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -235,7 +235,8 @@ void PatchEngineCallback(u64 userdata, int cyclesLate) // Patch mem and run the Action Replay PatchEngine::ApplyFramePatches(); PatchEngine::ApplyARPatches(); - CoreTiming::ScheduleEvent((CPU_CORE_CLOCK / 5000) - cyclesLate, et_PatchEngine); + + CoreTiming::ScheduleEvent((GetTicksPerSecond() / 60) - cyclesLate, et_PatchEngine); } void Init() diff --git a/Source/Core/Core/Src/PatchEngine.cpp b/Source/Core/Core/Src/PatchEngine.cpp index 6080c39b74..ec6cdd6849 100644 --- a/Source/Core/Core/Src/PatchEngine.cpp +++ b/Source/Core/Core/Src/PatchEngine.cpp @@ -19,7 +19,6 @@ // Supports simple memory patches, and has a partial Action Replay implementation // in ActionReplay.cpp/h. -// TODO: Still even needed? Zelda WW now works with improved DSP code. // Zelda item hang fixes: // [Tue Aug 21 2007] [18:30:40] 0x802904b4 in US released // [Tue Aug 21 2007] [18:30:53] 0x80294d54 in EUR Demo version diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 51df7a7c99..0c5ed2d6f7 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -76,11 +76,12 @@ CPluginManager::~CPluginManager() for (int i = 0; i < MAXPADS; i++) { - if (m_pad[i] && (OkayToInitPlugin(i) == -1) && !m_params->m_strPadPlugin[i].empty()) + if (m_pad[i] && (OkayToInitPlugin(i) == -1)) { INFO_LOG(CONSOLE, "Delete: %i\n", i); - FreePad(i); + delete m_pad[i]; } + m_pad[i] = NULL; } for (int i = 0; i < MAXWIIMOTES; i++) @@ -164,7 +165,7 @@ void CPluginManager::ShutdownPlugins() if (m_pad[i]) { m_pad[i]->Shutdown(); - //delete m_pad[i]; Causes crash on stop + //delete m_pad[i]; } //m_pad[i] = NULL; } @@ -301,7 +302,7 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number) PanicAlert("Can't open %s, it has a missing function", _rFilename); return NULL; } - + // Call the DLL function SetGlobals plugin->SetGlobals(m_PluginGlobals); return plugin; diff --git a/Source/Core/DSPCore/Src/DSPAccelerator.cpp b/Source/Core/DSPCore/Src/DSPAccelerator.cpp index 933fdb8f31..04dcd88a95 100644 --- a/Source/Core/DSPCore/Src/DSPAccelerator.cpp +++ b/Source/Core/DSPCore/Src/DSPAccelerator.cpp @@ -103,14 +103,11 @@ void dsp_write_aram_d3(u16 value) case 0xA: // 16-bit writes DSPHost_WriteHostMemory(value >> 8, Address); DSPHost_WriteHostMemory(value & 0xFF, Address + 1); - Address += 2; break; default: ERROR_LOG(DSPLLE, "dsp_write_aram_d3: Unseen Format %i", gdsp_ifx_regs[DSP_FORMAT]); break; } - gdsp_ifx_regs[DSP_ACCAH] = Address >> 16; - gdsp_ifx_regs[DSP_ACCAL] = Address & 0xffff; } u16 dsp_read_accelerator() @@ -156,10 +153,9 @@ u16 dsp_read_accelerator() // Set address back to start address. Address = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL]; - // Do we really need both? (nakee: seems to cause problems with some - // AX games) - // DSPHost_InterruptRequest(); - // DSPCore_SetException(EXP_2); + // Do we really need both? + DSPHost_InterruptRequest(); + DSPCore_SetException(EXP_2); DSPCore_SetException(EXP_ACCOV); // Somehow, YN1 and YN2 must be initialized with their "loop" values, diff --git a/Source/Core/DSPCore/Src/DSPHWInterface.cpp b/Source/Core/DSPCore/Src/DSPHWInterface.cpp index 35963aa87e..096ab9a226 100644 --- a/Source/Core/DSPCore/Src/DSPHWInterface.cpp +++ b/Source/Core/DSPCore/Src/DSPHWInterface.cpp @@ -161,7 +161,7 @@ void gdsp_ifx_write(u16 addr, u16 val) break; case 0xd3: // ZeldaUnk (accelerator WRITE) - // NOTICE_LOG(DSPLLE, "Write To ZeldaUnk pc=%04x (%04x)", g_dsp.pc, val); + NOTICE_LOG(DSPLLE, "Write To ZeldaUnk pc=%04x (%04x)", g_dsp.pc, val); dsp_write_aram_d3(val); break; @@ -215,7 +215,7 @@ u16 gdsp_ifx_read(u16 addr) return dsp_read_accelerator(); case 0xd3: - //NOTICE_LOG(DSPLLE, "Read from ZeldaUnk pc=%04x", g_dsp.pc); + NOTICE_LOG(DSPLLE, "Read from ZeldaUnk pc=%04x", g_dsp.pc); return dsp_read_aram_d3(); default: @@ -316,7 +316,7 @@ void gdsp_do_dma() exit(0); } #if defined(_DEBUG) || defined(DEBUGFAST) - DEBUG_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); + NOTICE_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); #endif switch (ctl & 0x3) { diff --git a/Source/Core/DSPCore/Src/DSPTables.cpp b/Source/Core/DSPCore/Src/DSPTables.cpp index f4d62794e1..6740446c6c 100644 --- a/Source/Core/DSPCore/Src/DSPTables.cpp +++ b/Source/Core/DSPCore/Src/DSPTables.cpp @@ -42,8 +42,6 @@ const DSPOPCTemplate opcodes[] = {"DAR", 0x0004, 0xfffc, DSPInterpreter::dar, nop, 1, 1, {{P_REG, 1, 0, 0, 0x0003}}, false}, {"IAR", 0x0008, 0xfffc, DSPInterpreter::iar, nop, 1, 1, {{P_REG, 1, 0, 0, 0x0003}}, false}, - {"ADDARN", 0x0010, 0xfff0, DSPInterpreter::addarn, nop, 1, 2, {{P_REG, 1, 0, 0, 0x0003}, {P_REG04, 1, 0, 2, 0x000c}}, false}, - {"HALT", 0x0021, 0xffff, DSPInterpreter::halt, nop, 1, 0, {}, false}, {"RETGE", 0x02d0, 0xffff, DSPInterpreter::ret, nop, 1, 0, {}, false}, @@ -126,9 +124,10 @@ const DSPOPCTemplate opcodes[] = {"LSR", 0x1440, 0xfec0, DSPInterpreter::lsr, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false}, {"ASL", 0x1480, 0xfec0, DSPInterpreter::asl, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false}, {"ASR", 0x14c0, 0xfec0, DSPInterpreter::asr, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false}, - - {"LSRN", 0x02ca, 0xffff, DSPInterpreter::lsrn, nop, 1, 0, {}, false}, // discovered by ector! - {"ASRN", 0x02cb, 0xffff, DSPInterpreter::asrn, nop, 1, 0, {}, false}, // discovered by ector! + + // discovered by ector! + {"LSRN", 0x02ca, 0xffff, DSPInterpreter::lsrn, nop, 1, 0, {}, false}, + {"ASRN", 0x02cb, 0xffff, DSPInterpreter::asrn, nop, 1, 0, {}, false}, {"LRI", 0x0080, 0xffe0, DSPInterpreter::lri, nop, 2, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_IMM, 2, 1, 0, 0xffff}}, false}, {"LR", 0x00c0, 0xffe0, DSPInterpreter::lr, nop, 2, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_MEM, 2, 1, 0, 0xffff}}, false}, @@ -138,20 +137,25 @@ const DSPOPCTemplate opcodes[] = {"SI", 0x1600, 0xff00, DSPInterpreter::si, nop, 2, 2, {{P_MEM, 1, 0, 0, 0x00ff}, {P_IMM, 2, 1, 0, 0xffff}}, false}, - {"ADDIS", 0x0400, 0xfe00, DSPInterpreter::addis, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}}, false}, - {"CMPIS", 0x0600, 0xfe00, DSPInterpreter::cmpis, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}}, false}, + {"LRS", 0x2000, 0xf800, DSPInterpreter::lrs, nop, 1, 2, {{P_REG18, 1, 0, 8, 0x0700}, {P_MEM, 1, 0, 0, 0x00ff}}, false}, + {"SRS", 0x2800, 0xf800, DSPInterpreter::srs, nop, 1, 2, {{P_MEM, 1, 0, 0, 0x00ff}, {P_REG18, 1, 0, 8, 0x0700}}, false}, + {"LRIS", 0x0800, 0xf800, DSPInterpreter::lris, nop, 1, 2, {{P_REG18, 1, 0, 8, 0x0700}, {P_IMM, 1, 0, 0, 0x00ff}}, false}, - {"ADDI", 0x0200, 0xfeff, DSPInterpreter::addi, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, // F|RES: missing S64 - {"XORI", 0x0220, 0xfeff, DSPInterpreter::xori, nop, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, + {"ADDIS", 0x0400, 0xfe00, DSPInterpreter::addis, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}}, false}, + {"CMPIS", 0x0600, 0xfe00, DSPInterpreter::cmpis, nop, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}}, false}, {"ANDI", 0x0240, 0xfeff, DSPInterpreter::andi, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, - {"ORI", 0x0260, 0xfeff, DSPInterpreter::ori, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, - {"CMPI", 0x0280, 0xfeff, DSPInterpreter::cmpi, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, - - {"ANDF", 0x02a0, 0xfeff, DSPInterpreter::andf, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, {"ANDCF", 0x02c0, 0xfeff, DSPInterpreter::andcf, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, + + {"XORI", 0x0220, 0xfeff, DSPInterpreter::xori, nop, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, + {"ANDF", 0x02a0, 0xfeff, DSPInterpreter::andf, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, + + {"ORI", 0x0260, 0xfeff, DSPInterpreter::ori, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, {"ORF", 0x02e0, 0xfeff, DSPInterpreter::orf, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, // Hermes: ??? (has it commented out) + {"ADDI", 0x0200, 0xfeff, DSPInterpreter::addi, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, // F|RES: missing S64 + {"CMPI", 0x0280, 0xfeff, DSPInterpreter::cmpi, nop, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}}, false}, + {"ILRR", 0x0210, 0xfefc, DSPInterpreter::ilrr, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_PRG, 1, 0, 0, 0x0003}}, false}, {"ILRRD", 0x0214, 0xfefc, DSPInterpreter::ilrrd, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_PRG, 1, 0, 0, 0x0003}}, false}, // Hermes doesn't list this {"ILRRI", 0x0218, 0xfefc, DSPInterpreter::ilrri, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_PRG, 1, 0, 0, 0x0003}}, false}, @@ -174,10 +178,8 @@ const DSPOPCTemplate opcodes[] = {"LOOPI", 0x1000, 0xff00, DSPInterpreter::loopi, nop, 1, 1, {{P_IMM, 1, 0, 0, 0x00ff}}, false}, {"BLOOPI", 0x1100, 0xff00, DSPInterpreter::bloopi, nop, 2, 2, {{P_IMM, 1, 0, 0, 0x00ff}, {P_ADDR_I, 2, 1, 0, 0xffff}}, false}, - //2 - {"LRS", 0x2000, 0xf800, DSPInterpreter::lrs, nop, 1, 2, {{P_REG18, 1, 0, 8, 0x0700}, {P_MEM, 1, 0, 0, 0x00ff}}, false}, - {"SRS", 0x2800, 0xf800, DSPInterpreter::srs, nop, 1, 2, {{P_MEM, 1, 0, 0, 0x00ff}, {P_REG18, 1, 0, 8, 0x0700}}, false}, - + {"ADDARN", 0x0010, 0xfff0, DSPInterpreter::addarn, nop, 1, 2, {{P_REG, 1, 0, 0, 0x0003}, {P_REG04, 1, 0, 2, 0x000c}}, false}, + // opcodes that can be extended // extended opcodes, note size of opcode will be set to 0 diff --git a/Source/Core/DSPCore/Src/DspIntArithmetic.cpp b/Source/Core/DSPCore/Src/DspIntArithmetic.cpp index ed5f5d6eb0..4687f97b21 100644 --- a/Source/Core/DSPCore/Src/DspIntArithmetic.cpp +++ b/Source/Core/DSPCore/Src/DspIntArithmetic.cpp @@ -33,7 +33,7 @@ void clr(const UDSPInstruction& opc) u8 reg = (opc.hex >> 11) & 0x1; dsp_set_long_acc(reg, 0); - Update_SR_Register64(0); + Update_SR_Register64((s64)0); // really? zeroWriteBackLog(); } diff --git a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp index 4f599cf6a0..d7d20ef434 100644 --- a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp +++ b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp @@ -455,7 +455,7 @@ void maddx(const UDSPInstruction& opc) u16 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); u16 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - s64 prod = dsp_multiply_add(val1, val2); + s64 prod = dsp_multiply_add(val1, val2, true); zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -474,7 +474,7 @@ void msubx(const UDSPInstruction& opc) u16 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); u16 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - s64 prod = dsp_multiply_sub(val1, val2); + s64 prod = dsp_multiply_sub(val1, val2, true); zeroWriteBackLog(); dsp_set_long_prod(prod); diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index 928af1bd45..44b5fd08a5 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -1,7 +1,7 @@ DoStop(); return 0; - case WM_USER_CREATE: + case OPENGL_WM_USER_CREATE: // We don't have a local setting for bRenderToMain but we can detect it this way instead //PanicAlert("main call %i %i %i %i", lParam, (HWND)Core::GetWindowHandle(), MSWGetParent_((HWND)Core::GetWindowHandle()), (HWND)this->GetHWND()); if (lParam == NULL) @@ -232,7 +232,6 @@ EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) EVT_MENU(IDM_INFO, CFrame::OnShow_InfoWindow) -EVT_MENU(IDM_RESTART, CFrame::OnRestart) EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc) EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu) EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen) @@ -304,7 +303,7 @@ CFrame::CFrame(wxFrame* parent, , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) , m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) , UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) - , bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false) + , bRenderToMain(true), bFloatLogWindow(false), bFloatConsoleWindow(false) , HaveLeds(false), HaveSpeakers(false) , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) #if wxUSE_TIMER @@ -495,24 +494,6 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) Close(true); } -void CFrame::OnRestart(wxCommandEvent& WXUNUSED (event)) -{ - if (Core::GetState() != Core::CORE_UNINITIALIZED) - { - wxMessageBox(wxT("Please stop the current game before restarting."), wxT("Notice"), wxOK, this); - return; - } - // Get exe path and restart - #ifdef _WIN32 - char Str[MAX_PATH + 1]; - DWORD Size = sizeof(Str)/sizeof(char); - DWORD n = GetModuleFileNameA(NULL, Str, Size); - ShellExecuteA(NULL, "open", Str, g_pCodeWindow ? "" : "-d", NULL, SW_SHOW); - #endif - - Close(true); -} - // -------- // Events @@ -691,7 +672,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event) #ifdef _WIN32 if(event.GetKeyCode() == 'M', '3', '4', '5', '6', '7') // Send this to the video plugin WndProc { - PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode()); + PostMessage((HWND)Core::GetWindowHandle(), WM_USER, OPENGL_WM_USER_KEYDOWN, event.GetKeyCode()); } #endif diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index c8df3c4954..e63189c227 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -250,7 +250,6 @@ class CFrame : public wxFrame #endif // Event functions void OnQuit(wxCommandEvent& event); - void OnRestart(wxCommandEvent& WXUNUSED (event)); void OnHelp(wxCommandEvent& event); void OnToolBar(wxCommandEvent& event); void OnAuiToolBar(wxAuiToolBarEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index eb9af94a37..466e62ac7b 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -127,12 +127,6 @@ void CFrame::ToggleConsole(bool bShow, int i) #ifdef _WIN32 ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener(); - // For developers: Use this to get a regular separate console window - /* - if(!GetConsoleWindow()) Console->Open(); else ShowWindow(GetConsoleWindow(), SW_SHOW); - return; - */ - if (bShow) { //Console->Log(LogTypes::LNOTICE, StringFromFormat(" >>> Show\n").c_str()); @@ -754,7 +748,7 @@ void CFrame::ResizeConsole() wxBorder = 2; Border = 4; LowerBorder = 6; - MenuBar = 26; // Including upper border + MenuBar = 30; // Including upper border ScrollBar = 19; } else // XP diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index ff4c19a731..970888c825 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -121,8 +121,6 @@ void CFrame::CreateMenu() fileMenu->AppendSeparator(); fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs...")); fileMenu->AppendSeparator(); - fileMenu->Append(IDM_RESTART, g_pCodeWindow ? _T("Restart in regular mode") : _T("Restart in debugging mode")); - fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt+F4")); m_MenuBar->Append(fileMenu, _T("&File")); diff --git a/Source/Core/DolphinWX/Src/InfoWindow.cpp b/Source/Core/DolphinWX/Src/InfoWindow.cpp index 0a947b1633..7b2d4e56f0 100644 --- a/Source/Core/DolphinWX/Src/InfoWindow.cpp +++ b/Source/Core/DolphinWX/Src/InfoWindow.cpp @@ -57,8 +57,7 @@ void wxInfoWindow::Init_ChildControls() Info.append(StringFromFormat( - "\n\n_-Computer Information-_\n\n%s\n%s\n%s\n\n_-Dolphin Information-_\n\n%s\n\n%s\n\n", - Summarize_OS().c_str(), + "\n\n%s\n%s\n%s\n\n%s\n\n", Summarize_Drives().c_str(), Summarize_CPU().c_str(), Summarize_Plug().c_str(), diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index cd6990befe..af7f873dbb 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -234,7 +234,7 @@ void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event)) for (int i = 0; i < msgQueueSize; i++) msgQueue.pop(); m_LogSection.Leave(); - + m_console->ClearScreen(); NOTICE_LOG(CONSOLE, "Console cleared"); NotifyUpdate(); @@ -517,12 +517,11 @@ void CLogWindow::UpdateLog() m_LogTimer->Start(UPDATETIME); } -// Receive log messages void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text) { m_LogSection.Enter(); - // Remove the first message if the queue is big - //if (msgQueue.size() >= 200) msgQueue.pop(); + if (msgQueue.size() >= 100) + msgQueue.pop(); msgQueue.push(std::pair((u8)level, wxString::FromAscii(text))); m_LogSection.Leave(); } diff --git a/Source/Core/DolphinWX/Src/Summarize.h b/Source/Core/DolphinWX/Src/Summarize.h index 12b789fd50..71fc925fd4 100644 --- a/Source/Core/DolphinWX/Src/Summarize.h +++ b/Source/Core/DolphinWX/Src/Summarize.h @@ -18,8 +18,6 @@ #ifndef __SUMMARIZE_H__ #define __SUMMARIZE_H__ -#include - std::string Summarize_Plug() { return StringFromFormat( @@ -106,7 +104,7 @@ std::string Summarize_CPU() { return StringFromFormat( "Processor Information: \n%s\n", - cpu_info.Summarize_long().c_str() + cpu_info.Summarize().c_str() ); } @@ -126,66 +124,4 @@ std::string Summarize_Drives() return drive; } - -std::string Summarize_OS(void) -{ - - std::string operatingSystem; - -#ifdef _WIN32 - #include - - OSVERSIONINFO osver; - osver.dwOSVersionInfoSize = sizeof(osver); - - if (GetVersionEx(&osver)) - { - switch(osver.dwMajorVersion) - { - case 6: - switch(osver.dwMinorVersion) - { - case 1: - if(osver.dwPlatformId == VER_NT_WORKSTATION) - operatingSystem = "Windows 7"; - else - operatingSystem += "Windows Server 2008 R2"; - break; - case 0: - if(osver.dwPlatformId == VER_NT_WORKSTATION) - operatingSystem = "Windows Vista"; - else - operatingSystem = "Windows Server 2008"; - break; - } - break; - case 5: - switch(osver.dwMinorVersion) - { - case 2: - if(GetSystemMetrics(SM_SERVERR2) != 0) - operatingSystem = "Windows Server 2003 R2"; - else - operatingSystem = "Windows Server 2003"; - break; - case 1: - operatingSystem = "Windows XP"; - break; - case 0: - operatingSystem = "Windows 2000"; - break; - } - break; - } - } -#else -#ifdef __linux__ - #include "linux/version.h" - operatingSystem = UTS_RELEASE; -#endif -#endif - return StringFromFormat("Operating System: %s",operatingSystem); -} - - -#endif //__SUMMARIZE_H__ +#endif //__SUMMARIZE_H__ \ No newline at end of file diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index 0edfe524cb..0caf01ccd3 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -35,63 +35,46 @@ #define _SDL_MAIN_ // Avoid certain declarations in SDL.h #include "SDL.h" // Local #include "XInput.h" -#ifdef _WIN32 -#include -#include -#pragma comment(lib, "dxguid.lib") -#pragma comment(lib, "dinput8.lib") -#endif +// Definitions +// ------------------- +int g_LastPad = 0; + + + namespace InputCommon { // Definitions // ------------------- -int g_LastPad = 0; -int NumDIDevices = 0; -// Reset and search for devices + + + +// Search attached devices. Populate joyinfo for all attached physical devices. // ----------------------- -bool SearchDevicesReset(std::vector &_joyinfo, int &_NumPads) +bool SearchDevices(std::vector &_joyinfo, int &_NumPads, int &_NumGoodPads) { - // This is needed to update SDL_NumJoysticks - if (SDL_WasInit(0)) - SDL_Quit(); - - return SearchDevices(_joyinfo, _NumPads); -} - -// Initialize if not previously initialized -// ----------------------- -bool SearchDevices(std::vector &_joyinfo, int &_NumPads) -{ - // Init Joystick + Haptic (force feedback) subsystem on SDL 1.3 if (!SDL_WasInit(0)) - { -#if SDL_VERSION_ATLEAST(1, 3, 0) && !defined(_WIN32) - NOTICE_LOG(PAD, "SDL_Init | HAPTIC"); +#if SDL_VERSION_ATLEAST(1, 3, 0) if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) #else - //NOTICE_LOG(PAD, "SDL_Init"); if (SDL_Init(SDL_INIT_JOYSTICK) < 0) #endif { PanicAlert("Could not initialize SDL: %s", SDL_GetError()); return false; } - } - // Clear joyinfo - _joyinfo.clear(); // Get device status int numjoy = SDL_NumJoysticks(); for (int i = 0; i < numjoy; i++ ) - { + { CONTROLLER_INFO Tmp; Tmp.joy = SDL_JoystickOpen(i); @@ -103,160 +86,39 @@ bool SearchDevices(std::vector &_joyinfo, int &_NumPads) Tmp.Name = SDL_JoystickName(i); // Check if the device is okay - if ( !( Tmp.NumAxes == 0 + if ( Tmp.NumAxes == 0 && Tmp.NumBalls == 0 && Tmp.NumButtons == 0 - && Tmp.NumHats == 0) + && Tmp.NumHats == 0 ) { - _joyinfo.push_back(Tmp); + Tmp.Good = false; } else { - //if (SDL_JoystickOpened(i)) SDL_JoystickClose(Tmp.joy); - } + _NumGoodPads++; + Tmp.Good = true; + } + + _joyinfo.push_back(Tmp); + + // We have now read the values we need so we close the device + if (SDL_JoystickOpened(i)) SDL_JoystickClose(_joyinfo[i].joy); } _NumPads = (int)_joyinfo.size(); + return true; } -// Show the current pad status -// ----------------- -std::string ShowStatus(int Slot, int Device, CONTROLLER_MAPPING PadMapping[], CONTROLLER_STATE PadState[], - std::vector joyinfo) -{ - CONTROLLER_MAPPING_NEW _PadMapping[4]; - CONTROLLER_STATE_NEW _PadState[4]; - for (int i = 0; i < 4; i++) - { - _PadMapping[i].ID = PadMapping[i].ID; - _PadMapping[i].Name = PadMapping[i].Name; - _PadState[i].joy = PadState[i].joy; - } - return DoShowStatus(Slot, Device, _PadMapping, _PadState, joyinfo); -} -std::string DoShowStatus(int Slot, int Device, - CONTROLLER_MAPPING_NEW PadMapping[], CONTROLLER_STATE_NEW PadState[], - std::vector joyinfo) -{ - // Save the physical device - int ID = PadMapping[Slot].ID; - // Make local shortcut - SDL_Joystick *joy = PadState[Slot].joy; - - // Make shortcuts for all pads - SDL_Joystick *joy0 = PadState[0].joy; - SDL_Joystick *joy1 = PadState[1].joy; - SDL_Joystick *joy2 = PadState[2].joy; - SDL_Joystick *joy3 = PadState[3].joy; - - // Temporary storage - std::string - StrAllHandles, StrAllName, - StrHandles, StrId, StrName, - StrAxes, StrHats, StrBut; - int value; - - // All devices - int numjoy = SDL_NumJoysticks(); - for (int i = 0; i < numjoy; i++ ) - { - SDL_Joystick *AllJoy = SDL_JoystickOpen(i); - StrAllHandles += StringFromFormat(" %i:%06i", i, AllJoy); - StrAllName += StringFromFormat("Name %i: %s\n", i, SDL_JoystickName(i)); - } - - // Get handles - for(int i = 0; i < joyinfo.size(); i++) - { - StrHandles += StringFromFormat(" %i:%06i", i, joyinfo.at(i).joy); - StrId += StringFromFormat(" %i:%i", i, joyinfo.at(i).ID); - StrName += StringFromFormat("Name %i:%s\n", i, joyinfo.at(i).Name.c_str()); - } - - // Get status - int Axes = joyinfo[Device].NumAxes; - int Balls = joyinfo[Device].NumBalls; - int Hats = joyinfo[Device].NumHats; - int Buttons = joyinfo[Device].NumButtons; - - // Update the internal values - SDL_JoystickUpdate(); - - // Go through all axes and read out their values - for(int i = 0; i < Axes; i++) - { - value = SDL_JoystickGetAxis(joy, i); - StrAxes += StringFromFormat(" %i:%06i", i, value); - } - for(int i = 0;i < Hats; i++) - { - value = SDL_JoystickGetHat(joy, i); - StrHats += StringFromFormat(" %i:%i", i, value); - } - for(int i = 0;i < Buttons; i++) - { - value = SDL_JoystickGetButton(joy, i); - StrBut += StringFromFormat(" %i:%i", i+1, value); - } - - return StringFromFormat( - "All devices:\n" - "Handles: %s\n" - "%s" - - "\nAll pads:\n" - "Handles: %s\n" - "ID: %s\n" - "%s" - - "\nAll slots:\n" - "ID: %i %i %i %i\n" - "Name: '%s' '%s' '%s' '%s'\n" - //"Controllertype: %i %i %i %i\n" - //"SquareToCircle: %i %i %i %i\n\n" - #ifdef _WIN32 - "Handles: %i %i %i %i\n" - //"XInput: %i %i %i\n" - #endif - - "\nThis pad:\n" - "Handle: %06i\n" - "ID: %i\n" - //"Slot: %i\n" - "Axes: %s\n" - "Hats: %s\n" - "But: %s\n" - "Device: Ax: %i Balls:%i Hats:%i But:%i", - StrAllHandles.c_str(), StrAllName.c_str(), - StrHandles.c_str(), StrId.c_str(), StrName.c_str(), - - PadMapping[0].ID, PadMapping[1].ID, PadMapping[2].ID, PadMapping[3].ID, - PadMapping[0].Name.c_str(), PadMapping[1].Name.c_str(), PadMapping[2].Name.c_str(), PadMapping[3].Name.c_str(), - //PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype, - //PadMapping[0].bSquareToCircle, PadMapping[1].bSquareToCircle, PadMapping[2].bSquareToCircle, PadMapping[3].bSquareToCircle, - #ifdef _WIN32 - joy0, joy1, joy2, joy3, - //PadState[PadMapping[0].ID].joy, PadState[PadMapping[1].ID].joy, PadState[PadMapping[2].ID].joy, PadState[PadMapping[3].ID].joy, - //XInput::IsConnected(0), XInput::GetXI(0, InputCommon::XI_TRIGGER_L), XInput::GetXI(0, InputCommon::XI_TRIGGER_R), - joy, - #endif - //Slot, - ID, - StrAxes.c_str(), StrHats.c_str(), StrBut.c_str(), - Axes, Balls, Hats, Buttons - ); -} - // Supporting functions -// ==================== +// ---------------- // Read current joystick status -/* -------------------- +/* ---------------- The value PadMapping[].buttons[] is the number of the assigned joypad button, PadState[].buttons[] is the status of the button, it becomes 0 (no pressed) or 1 (pressed) */ @@ -278,15 +140,10 @@ void ReadButton(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int Input: The virtual device 0, 1, 2 or 3 Function: Updates the PadState struct with the current pad status. The input value "controller" is for a virtual controller 0 to 3. */ -void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping) -{ - if (SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE) return; - //NOTICE_LOG(PAD, "SDL_JoystickEventState: %s", (SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE) ? "SDL_ENABLE" : "SDL_IGNORE"); - +void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int Controller, int NumButtons) +{ // Update the gamepad status SDL_JoystickUpdate(); - // Read info - int NumButtons = SDL_JoystickNumButtons(_PadState.joy); // Update axis states. It doesn't hurt much if we happen to ask for nonexisting axises here. _PadState.axis[CTL_MAIN_X] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.axis[CTL_MAIN_X]); @@ -349,13 +206,12 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping) } #ifdef SHOW_PAD_STATUS - /* // Show the status of all connected pads //ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - //if ((g_LastPad == 0 && _PadMapping.ID == 0) || Controller < g_LastPad) Console->ClearScreen(); + //if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console->ClearScreen(); g_LastPad = Controller; NOTICE_LOG(CONSOLE, - "Pad | Number:%i Handle:%i\n" + "Pad | Number:%i Enabled:%i Handle:%i\n" "Main Stick | X:%03i Y:%03i\n" "C Stick | X:%03i Y:%03i\n" "Trigger | Type:%s DigitalL:%i DigitalR:%i AnalogL:%03i AnalogR:%03i HalfPress:%i\n" @@ -363,7 +219,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping) "D-Pad | Type:%s Hat:%i U:%i D:%i\n" "======================================================\n", - _PadMapping.ID, _PadState.joy, + Controller, _PadMapping.enabled, _PadState.joy, _PadState.axis[InputCommon::CTL_MAIN_X], _PadState.axis[InputCommon::CTL_MAIN_Y], _PadState.axis[InputCommon::CTL_SUB_X], _PadState.axis[InputCommon::CTL_SUB_Y], @@ -379,7 +235,6 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping) _PadState.dpad, _PadState.dpad2[InputCommon::CTL_D_PAD_UP], _PadState.dpad2[InputCommon::CTL_D_PAD_DOWN] ); - */ #endif } @@ -408,23 +263,18 @@ bool AvoidValues(int value, bool NoTriggerFilter) // Detect a pressed button // --------------------- -void GetButton(SDL_Joystick *joy, int ControllerID, +void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int hats, int &KeyboardKey, int &value, int &type, int &pressed, bool &Succeed, bool &Stop, bool LeftRight, bool Axis, bool XInput, bool Button, bool Hat, bool NoTriggerFilter) { // It needs the wxWidgets excape keycode static const int WXK_ESCAPE = 27; - // Save info - int buttons = SDL_JoystickNumButtons(joy); - int axes = SDL_JoystickNumAxes(joy);; - int hats = SDL_JoystickNumHats(joy);; - // Update the internal status SDL_JoystickUpdate(); // For the triggers we accept both a digital or an analog button - if (Axis) + if(Axis) { for(int i = 0; i < axes; i++) { @@ -439,7 +289,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, } // Check for a hat - if (Hat) + if(Hat) { for(int i = 0; i < hats; i++) { @@ -520,41 +370,5 @@ void GetButton(SDL_Joystick *joy, int ControllerID, -// ********************************************** - - - -// Search for DirectInput devices -// ---------------- -#ifdef _WIN32 -BOOL CALLBACK EnumDICallback(const DIDEVICEINSTANCE* pInst, VOID* pContext) -{ - NumDIDevices++; - return true; -} -#endif -int SearchDIDevices() -{ - #ifdef _WIN32 - LPDIRECTINPUT8 g_pObject; - LPDIRECTINPUTDEVICE8 g_pDevice; - DIPROPDWORD dipdw; - HRESULT hr; - NumDIDevices = 0; - - // Register with the DirectInput subsystem and get a pointer to a IDirectInput interface we can use. - if (FAILED(hr = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pObject, NULL))) - return 0; - - // Look for a device - if (FAILED(hr = g_pObject->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumDICallback, NULL, DIEDFL_ATTACHEDONLY))) - return 0; - return NumDIDevices; - #else - return 0; - #endif -} - - } // InputCommon diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index e49b8aab33..40c121f96f 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -53,7 +53,7 @@ #endif #include "Common.h" // Common -#include "StringUtil.h" + namespace InputCommon @@ -62,7 +62,7 @@ namespace InputCommon // Settings // ---------- -// Show a status window with the detected devices etc +// Show a status window with the detected axes, buttons and so on //#define SHOW_PAD_STATUS @@ -82,7 +82,7 @@ struct CONTROLLER_STATE // GC PAD INFO/STATE int dpad; // Automatic SDL D-Pad (8 directions + neutral) int dpad2[4]; // D-pad using buttons int axis[6]; // 2 x 2 Axes (Main & Sub) - int halfpress; // L and R triggers half pressed + int halfpress; // Halfpress... you know, like not fully pressed ;)... SDL_Joystick *joy; // SDL joystick device }; @@ -95,7 +95,6 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING int halfpress; // (See above) int deadzone; // Deadzone... what else? int ID; // SDL joystick device ID - std::string Name; // SDL joystick device name int controllertype; // Hat: Hat or custom buttons int triggertype; // Triggers range std::string SRadius, SDiagonal, SRadiusC, SDiagonalC; @@ -112,6 +111,7 @@ struct CONTROLLER_INFO // CONNECTED WINDOWS DEVICES INFO int NumHats; // Amount of Hats (POV) std::string Name; // Joypad/stickname int ID; // SDL joystick device ID + bool Good; // Pad is good (it has at least one button or axis) SDL_Joystick *joy; // SDL joystick device }; enum @@ -220,7 +220,6 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING int DeadZoneL; // Analog 1 Deadzone int DeadZoneR; // Analog 2 Deadzone int ID; // SDL joystick device ID - std::string Name; // SDL joystick device name int controllertype; // D-Pad type: Hat or custom buttons int triggertype; // SDL or XInput trigger std::string SDiagonal; @@ -237,14 +236,9 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING // --------- // General functions -bool SearchDevicesReset(std::vector &_joyinfo, int &NumPads); -bool SearchDevices(std::vector &_joyinfo, int &NumPads); -std::string ShowStatus(int Slot, int Device, CONTROLLER_MAPPING PadMapping[], CONTROLLER_STATE PadState[], - std::vector joyinfo); -std::string DoShowStatus(int Slot, int Device, CONTROLLER_MAPPING_NEW PadMapping[], CONTROLLER_STATE_NEW PadState[], - std::vector joyinfo); -void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping); -void GetButton(SDL_Joystick*, int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool,bool); +bool SearchDevices(std::vector &_joyinfo, int &NumPads, int &NumGoodPads); +void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int controller, int NumButtons); +void GetButton(SDL_Joystick*, int,int,int,int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool,bool); // Value conversion float Deg2Rad(float Deg); @@ -262,9 +256,7 @@ std::string VKToString(int keycode); extern int g_LastPad; #endif -// DirectInput -extern int NumDIDevices; -int SearchDIDevices(); + } // InputCommon diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index 0f7de16c23..51bc778aa5 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -120,7 +120,7 @@ void PixelShaderManager::SetConstants() break; case 2: // 24 bits - ftemp[0] = ffrac/65536.0f; ftemp[1] = ffrac/256.0f; ftemp[2] = ffrac; ftemp[3] = 0; + ftemp[0] = ffrac/65536.0f; ftemp[1] = ffrac/256.0f; ftemp[2] = ffrac; ftemp[3] = ffrac/16777216.0f; break; } SetPSConstant4fv(C_ZBIAS, ftemp); diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index 5f82c25ec1..9c09ad37cb 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -60,25 +60,6 @@ int TexDecoder_GetTexelSizeInNibbles(int format) case GX_TF_C8: return 2; case GX_TF_C14X2: return 4; case GX_TF_CMPR: return 1; - case GX_CTF_R4: return 1; - case GX_CTF_RA4: return 2; - case GX_CTF_RA8: return 4; - case GX_CTF_YUVA8: return 8; - case GX_CTF_A8: return 2; - case GX_CTF_R8: return 2; - case GX_CTF_G8: return 2; - case GX_CTF_B8: return 2; - case GX_CTF_RG8: return 4; - case GX_CTF_GB8: return 4; - - case GX_TF_Z8: return 2; - case GX_TF_Z16: return 4; - case GX_TF_Z24X8: return 8; - - case GX_CTF_Z4: return 1; - case GX_CTF_Z8M: return 2; - case GX_CTF_Z8L: return 2; - case GX_CTF_Z16L: return 4; default: return 1; } } diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln index 43a5caca22..c8b14c01dd 100644 --- a/Source/Dolphin.sln +++ b/Source/Dolphin.sln @@ -95,7 +95,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL", "Plugins\ ProjectSection(ProjectDependencies) = postProject {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} {11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED} - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} EndProjectSection EndProject @@ -115,7 +114,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_Wiimote", "Plugins\P ProjectSection(ProjectDependencies) = postProject {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} {11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED} - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} @@ -201,8 +199,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoSoftware", "Plu {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "..\Externals\SDL\VisualC\SDL\SDL_VS2008.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -700,22 +696,6 @@ Global {66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|Win32.Build.0 = Release|Win32 {66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.ActiveCfg = Release|x64 {66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.Build.0 = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.ActiveCfg = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.Build.0 = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.DebugFast|Win32.ActiveCfg = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.DebugFast|Win32.Build.0 = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.DebugFast|x64.ActiveCfg = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.DebugFast|x64.Build.0 = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_JITIL|Win32.ActiveCfg = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_JITIL|Win32.Build.0 = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_JITIL|x64.ActiveCfg = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_JITIL|x64.Build.0 = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.ActiveCfg = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.Build.0 = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index daf8a8e325..cb8c595471 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -23,10 +23,10 @@ enum PLUGIN_COMM { // Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on - WM_USER_STOP = 10, - WM_USER_CREATE, - WM_USER_KEYDOWN, - WM_USER_VIDEO_STOP, + OPENGL_WM_USER_STOP = 10, + OPENGL_WM_USER_CREATE, + OPENGL_WM_USER_KEYDOWN, + OPENGL_VIDEO_STOP, TOGGLE_FULLSCREEN, VIDEO_DESTROY, // The video debugging window was destroyed AUDIO_DESTROY, // The audio debugging window was destroyed diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp index 2e4029015c..07c6525f2d 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp @@ -48,6 +48,7 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler, u32 l_CRC) { // we got loaded m_rMailHandler.PushMail(0xDCD10000); + m_rMailHandler.PushMail(0x80000000); // handshake ??? only (crc == 0xe2136399) needs it ... templbuffer = new int[1024 * 1024]; temprbuffer = new int[1024 * 1024]; @@ -69,12 +70,9 @@ void CUCode_AXWii::HandleMail(u32 _uMail) { // a new List } - else if (_uMail == 0xCDD10000) // Action 0 - restart - { - m_rMailHandler.PushMail(0xDCD10001); - } - else if ((_uMail & 0xFFFF0000) == 0xCDD10000) // Action 1/2/3 + else if ((_uMail & 0xFFFF0000) == 0xCDD10000) { + //NOTICE_LOG(DSPHLE, "action mail %08X", _uMail); } else { @@ -373,13 +371,11 @@ bool CUCode_AXWii::AXTask(u32& _uMail) case 0x000b: uAddress += 2; // one 0x8000 in rabbids uAddress += 4 * 2; // then two RAM addressses - m_rMailHandler.PushMail(0xDCD10004); break; case 0x000c: uAddress += 2; // one 0x8000 in rabbids uAddress += 4 * 2; // then two RAM addressses - m_rMailHandler.PushMail(0xDCD10004); break; case 0x000d: @@ -389,7 +385,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail) case 0x000e: // This is the end. bExecuteList = false; - m_rMailHandler.PushMail(0xDCD10002); + SaveLog("%08x : AXLIST end, wii stylee.", uAddress); break; default: @@ -432,6 +428,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail) SaveLog("====================================================================="); SaveLog("End"); + m_rMailHandler.PushMail(0xDCD10002); return true; } diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index 4028320c9e..3d44f89979 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -319,13 +319,7 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail) void DSP_Update(int cycles) { // This gets called VERY OFTEN. The soundstream update might be expensive so only do it 200 times per second or something. - int cycles_between_ss_update; - - if (g_dspInitialize.bWii) - cycles_between_ss_update = 121500000 / 200; - else - cycles_between_ss_update = 81000000 / 200; - + const int cycles_between_ss_update = 80000000 / 200; static int cycle_count = 0; cycle_count += cycles; if (cycle_count > cycles_between_ss_update) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp index fe83f93331..3e6fb7e4b2 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp @@ -398,18 +398,18 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture, { SaveRenderStates(); - //float span = ((rSource->right-rSource->left - 1.0f) * (rDest->right - rDest->left))/(SourceWidth*((rDest->right - rDest->left)-1.0f)); - float u1=((float)rSource->left+1.0f)/(float) SourceWidth;//*/((0.5f+rSource->left)/(float) SourceWidth)-(span*0.5f/(float)(rDest->right - rDest->left)); - float u2=((float)rSource->right-1.0f)/(float) SourceWidth;;//*/u1+span; - //span = ((rSource->bottom-rSource->top - 1.0f) * (rDest->bottom - rDest->top))/(SourceHeight*((rDest->bottom - rDest->top)-1.0f)); - float v1=((float)rSource->top+1.0f)/(float) SourceHeight;//*/((0.5f+rSource->top)/(float) SourceHeight)-(span*0.5f/(float)(rDest->bottom - rDest->top)); - float v2=((float)rSource->bottom-1.0f)/(float) SourceHeight;//*/v1+span; + float span = ((rSource->right-rSource->left - 1.0f) * (rDest->right - rDest->left))/(SourceWidth*((rDest->right - rDest->left)-1.0f)); + float u1=((0.5f+rSource->left)/(float) SourceWidth)-(span*0.5f/(float)(rDest->right - rDest->left)); + float u2=u1+span; + span = ((rSource->bottom-rSource->top - 1.0f) * (rDest->bottom - rDest->top))/(SourceHeight*((rDest->bottom - rDest->top)-1.0f)); + float v1=((0.5f+rSource->top)/(float) SourceHeight)-(span*0.5f/(float)(rDest->bottom - rDest->top)); + float v2=v1+span; struct Q2DVertex { float x,y,z,rhw,u,v; } coords[4] = { - {(float)rDest->left-0.5f, (float)rDest->top-0.5f, 0.0f, 1.0f, u1, v1}, - {(float)rDest->right-0.5f, (float)rDest->top-0.5f, 0.0f,1.0f, u2, v1}, - {(float)rDest->right-0.5f, (float)rDest->bottom-0.5f, 0.0f,1.0f, u2, v2}, - {(float)rDest->left-0.5f, (float)rDest->bottom-0.5f, 0.0f,1.0f, u1, v2} + {(float)rDest->left-1.0f, (float)rDest->top-1.0f, 0.0f, 1.0f, u1, v1}, + {(float)rDest->right, (float)rDest->top-1.0f, 0.0f,1.0f, u2, v1}, + {(float)rDest->right, (float)rDest->bottom, 0.0f,1.0f, u2, v2}, + {(float)rDest->left-1.0f, (float)rDest->bottom, 0.0f,1.0f, u1, v2} }; dev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1); dev->SetVertexShader(Vshader); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.cpp index b2160622c4..8f9707be88 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.cpp @@ -359,9 +359,6 @@ static void DX9DebuggerUpdateScreen() D3D::dev->Present(NULL, NULL, NULL, NULL); D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface()); - - if(D3D::GetCaps().NumSimultaneousRTs > 1) - D3D::dev->SetRenderTarget(1,FBManager::GetEFBDepthEncodedSurface()); D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface()); D3D::dev->BeginScene(); } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index 1b05899394..d30678e207 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -10,7 +10,6 @@ namespace EmuWindow { HWND m_hWnd = NULL; -HWND m_hMain = NULL; HWND m_hParent = NULL; HINSTANCE m_hInstance = NULL; WNDCLASSEX wndClass; @@ -37,9 +36,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) { switch( iMsg ) { - case WM_CREATE: - PostMessage( m_hMain, WM_USER, WM_USER_CREATE, g_Config.RenderToMainframe ); - break; case WM_PAINT: { HDC hdc; @@ -58,18 +54,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) break; case WM_KEYDOWN: - switch (LOWORD(wParam)) - { - case VK_ESCAPE: - SendMessage(m_hWnd, WM_CLOSE, 0, 0); - break; - } - g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0); - break; - case WM_SYSKEYDOWN: switch( LOWORD( wParam )) { - case VK_RETURN: // Pressing Esc switch FullScreen/Windowed + case VK_ESCAPE: // Pressing Esc switch FullScreen/Windowed if (g_ActiveConfig.bFullscreen) { DestroyWindow(hWnd); @@ -131,7 +118,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) }*/ break; } - //g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0); + g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0); break; /* Post thes mouse events to the main window, it's nessesary because in difference to the @@ -145,7 +132,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) case WM_CLOSE: //Fifo_ExitLoopNonBlocking(); //Shutdown(); - PostMessage( m_hMain, WM_USER, WM_USER_STOP, 0 ); + PostMessage( m_hParent, WM_USER, OPENGL_WM_USER_STOP, 0 ); // Simple hack to easily exit without stopping. Hope to fix the stopping errors soon. //ExitProcess(0); return 0; @@ -200,7 +187,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T if (g_Config.RenderToMainframe) { - m_hParent = m_hMain = parent; + m_hParent = parent; m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD, 0, 0, width, height, @@ -211,8 +198,6 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T } else { - m_hMain = parent; - DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW; RECT rc = {0, 0, width, height}; @@ -228,7 +213,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T m_hWnd = CreateWindowEx(0, m_szClassName, title, style, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, - NULL, NULL, hInstance, NULL); + NULL, NULL, hInstance, NULL ); } return m_hWnd; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 323fd15303..d496c7ba62 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -75,31 +75,6 @@ void TextureCache::Invalidate(bool shutdown) textures.clear(); } -void TextureCache::InvalidateRange(u32 start_address, u32 size) -{ - TexCache::iterator iter = textures.begin(); - while (iter != textures.end()) - { - if (iter->second.IntersectsMemoryRange(start_address, size)) - { - iter->second.Destroy(false); - ERASE_THROUGH_ITERATOR(textures, iter); - } - else { - ++iter; - } - } -} - -bool TextureCache::TCacheEntry::IntersectsMemoryRange(u32 range_address, u32 range_size) -{ - if (addr + size_in_bytes < range_address) - return false; - if (addr >= range_address + range_size) - return false; - return true; -} - void TextureCache::Shutdown() { Invalidate(true); @@ -208,7 +183,6 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, D3DFORMAT d3d_fmt; switch (pcfmt) { case PC_TEX_FMT_BGRA32: - case PC_TEX_FMT_RGBA32: d3d_fmt = D3DFMT_A8R8G8B8; break; case PC_TEX_FMT_RGB565: @@ -230,7 +204,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, d3d_fmt = D3DFMT_DXT1; break; } - + //Make an entry in the table TCacheEntry& entry = textures[texID]; @@ -336,7 +310,25 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo tex = entry.texture; } -have_texture: +have_texture: + /*TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect); + RECT source_rc; + source_rc.left = targetSource.left; + source_rc.top = targetSource.top; + source_rc.right = targetSource.right; + source_rc.bottom = targetSource.bottom; + RECT dest_rc; + dest_rc.left = 0; + dest_rc.top = 0; + dest_rc.right = tex_w; + dest_rc.bottom = tex_h; + + LPDIRECT3DSURFACE9 srcSurface, destSurface; + tex->GetSurfaceLevel(0, &destSurface); + srcSurface = FBManager::GetEFBColorRTSurface(); + D3D::dev->StretchRect(srcSurface, &source_rc, destSurface, &dest_rc, D3DTEXF_LINEAR); + destSurface->Release(); + return;*/ float colmat[16]= {0.0f}; float fConstAdd[4] = {0.0f}; @@ -454,8 +446,7 @@ have_texture: hr = tex->GetSurfaceLevel(0,&Rendersurf); CHECK(hr); D3D::dev->SetDepthStencilSurface(NULL); - if(D3D::GetCaps().NumSimultaneousRTs > 1) - D3D::dev->SetRenderTarget(1, NULL); + D3D::dev->SetRenderTarget(1, NULL); D3D::dev->SetRenderTarget(0, Rendersurf); D3DVIEWPORT9 vp; @@ -477,18 +468,17 @@ have_texture: PixelShaderManager::SetColorMatrix(colmat, fConstAdd); // set transformation - TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect); + //TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect); RECT sourcerect; - sourcerect.bottom = targetSource.bottom; - sourcerect.left = targetSource.left; - sourcerect.right = targetSource.right; - sourcerect.top = targetSource.top; + sourcerect.bottom = source_rect.bottom; + sourcerect.left = source_rect.left; + sourcerect.right = source_rect.right; + sourcerect.top = source_rect.top; - D3D::drawShadedTexQuad(read_texture,&sourcerect, Renderer::GetTargetWidth() , Renderer::GetTargetHeight(),&destrect,(FBManager::GetEFBDepthRTSurfaceFormat() == D3DFMT_R32F && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(): PixelShaderCache::GetColorMatrixProgram(),VertexShaderCache::GetSimpleVertexSahder()); + D3D::drawShadedTexQuad(read_texture,&sourcerect, EFB_WIDTH , EFB_HEIGHT,&destrect,(FBManager::GetEFBDepthRTSurfaceFormat() == D3DFMT_R32F && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(): PixelShaderCache::GetColorMatrixProgram(),NULL); D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface()); - if(D3D::GetCaps().NumSimultaneousRTs > 1) - D3D::dev->SetRenderTarget(1, FBManager::GetEFBDepthEncodedSurface()); + D3D::dev->SetRenderTarget(1, FBManager::GetEFBDepthEncodedSurface()); D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface()); VertexShaderManager::SetViewportChanged(); Renderer::RestoreAPIState(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h index 66ead6d5ec..a3cba00bfe 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h @@ -53,7 +53,6 @@ public: oldpixel = 0; } void Destroy(bool shutdown); - bool IntersectsMemoryRange(u32 range_address, u32 range_size); }; private: @@ -68,7 +67,6 @@ public: static void Cleanup(); static void Shutdown(); static void Invalidate(bool shutdown); - static void InvalidateRange(u32 start_address, u32 size); static TCacheEntry *Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect); }; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.h b/Source/Plugins/Plugin_VideoDX9/Src/resource.h index c6c12dcfe5..ef7fb34e98 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.h @@ -2,43 +2,1540 @@ // Microsoft Visual C++ generated include file. // Used by Resource.rc // -#define IDD_DEBUGGER 101 -#define IDD_ABOUT 102 -#define IDD_SETTINGS 103 -#define IDD_ENHANCEMENTS 104 -#define IDD_ADVANCED 105 - -#define IDC_ADAPTER 1001 -#define IDC_ANTIALIASMODE 1002 -#define IDC_RESOLUTION 1003 -#define IDC_RESOLUTIONWINDOWED 1004 -#define IDC_FULLSCREENENABLE 1005 -#define IDC_VSYNC 1006 -#define IDC_RENDER_TO_MAINWINDOW 1007 -#define IDC_ASPECT_16_9 1008 -#define IDC_ASPECT_4_3 1009 -#define IDC_WIDESCREEN_HACK 1010 -#define IDC_SAFE_TEXTURE_CACHE 1011 -#define IDC_EFB_ACCESS_ENABLE 1012 -#define IDC_WIREFRAME 1013 -#define IDC_OVERLAYSTATS 1014 -#define IDC_OVERLAYPROJSTATS 1015 -#define IDC_TEXDUMP 1016 -#define IDC_DUMPFRAMES 1017 -#define IDC_SHOWSHADERERRORS 1018 -#define IDC_TEXFMT_OVERLAY 1019 -#define IDC_TEXFMT_CENTER 1020 -#define IDC_FORCEFILTERING 1021 -#define IDC_FORCEANISOTROPY 1022 - -#define IDC_CHECK1 1023 -#define IDC_LIST1 1024 -#define IDC_DEBUGSTEP 1025 -#define IDC_REGISTERS 1026 -#define IDC_ENABLEDEBUGGING 1027 -#define IDC_REGISTERSELECT 1028 - +#define SW_HIDE 0 +#define HIDE_WINDOW 0 +#define WM_NULL 0x0000 +#define WA_INACTIVE 0 +#define HTNOWHERE 0 +#define SMTO_NORMAL 0x0000 +#define ICON_SMALL 0 +#define SIZE_RESTORED 0 +#define BN_CLICKED 0 +#define BST_UNCHECKED 0x0000 +#define HDS_HORZ 0x0000 +#define TBSTYLE_BUTTON 0x0000 +#define TBS_HORZ 0x0000 +#define TBS_BOTTOM 0x0000 +#define TBS_RIGHT 0x0000 +#define LVS_ICON 0x0000 +#define LVS_ALIGNTOP 0x0000 +#define TCS_TABS 0x0000 +#define TCS_SINGLELINE 0x0000 +#define TCS_RIGHTJUSTIFY 0x0000 +#define DTS_SHORTDATEFORMAT 0x0000 +#define PGS_VERT 0x00000000 +#define LANG_NEUTRAL 0x00 +#define SUBLANG_NEUTRAL 0x00 +#define SORT_DEFAULT 0x0 +#define SORT_JAPANESE_XJIS 0x0 +#define SORT_CHINESE_BIG5 0x0 +#define SORT_CHINESE_PRCP 0x0 +#define SORT_KOREAN_KSC 0x0 +#define SORT_HUNGARIAN_DEFAULT 0x0 +#define SORT_GEORGIAN_TRADITIONAL 0x0 +#define _USE_DECLSPECS_FOR_SAL 0 +#define _USE_ATTRIBUTES_FOR_SAL 0 +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 +#define SW_SHOWNORMAL 1 +#define SW_NORMAL 1 +#define SHOW_OPENWINDOW 1 +#define SW_PARENTCLOSING 1 +#define VK_LBUTTON 0x01 +#define WM_CREATE 0x0001 +#define WA_ACTIVE 1 +#define PWR_OK 1 +#define PWR_SUSPENDREQUEST 1 +#define NFR_ANSI 1 +#define UIS_SET 1 +#define UISF_HIDEFOCUS 0x1 +#define XBUTTON1 0x0001 +#define WMSZ_LEFT 1 +#define HTCLIENT 1 +#define SMTO_BLOCK 0x0001 +#define MA_ACTIVATE 1 +#define ICON_BIG 1 +#define SIZE_MINIMIZED 1 +#define MK_LBUTTON 0x0001 +#define TME_HOVER 0x00000001 +#define CS_VREDRAW 0x0001 +#define CF_TEXT 1 +#define SCF_ISSECURE 0x00000001 +#define IDOK 1 +#define BN_PAINT 1 +#define BST_CHECKED 0x0001 +#define TBSTYLE_SEP 0x0001 +#define TTS_ALWAYSTIP 0x01 +#define TBS_AUTOTICKS 0x0001 +#define UDS_WRAP 0x0001 +#define PBS_SMOOTH 0x01 +#define LWS_TRANSPARENT 0x0001 +#define LVS_REPORT 0x0001 +#define TVS_HASBUTTONS 0x0001 +#define TCS_SCROLLOPPOSITE 0x0001 +#define ACS_CENTER 0x0001 +#define MCS_DAYSTATE 0x0001 +#define DTS_UPDOWN 0x0001 +#define PGS_HORZ 0x00000001 +#define NFS_EDIT 0x0001 +#define BCSIF_GLYPH 0x0001 +#define BCSS_NOSPLIT 0x0001 +#define LANG_ARABIC 0x01 +#define SUBLANG_DEFAULT 0x01 +#define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 +#define SUBLANG_ALBANIAN_ALBANIA 0x01 +#define SUBLANG_ALSATIAN_FRANCE 0x01 +#define SUBLANG_AMHARIC_ETHIOPIA 0x01 +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARMENIAN_ARMENIA 0x01 +#define SUBLANG_ASSAMESE_INDIA 0x01 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_BASHKIR_RUSSIA 0x01 +#define SUBLANG_BASQUE_BASQUE 0x01 +#define SUBLANG_BELARUSIAN_BELARUS 0x01 +#define SUBLANG_BENGALI_INDIA 0x01 +#define SUBLANG_BRETON_FRANCE 0x01 +#define SUBLANG_BULGARIAN_BULGARIA 0x01 +#define SUBLANG_CATALAN_CATALAN 0x01 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CORSICAN_FRANCE 0x01 +#define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 +#define SUBLANG_CROATIAN_CROATIA 0x01 +#define SUBLANG_DANISH_DENMARK 0x01 +#define SUBLANG_DARI_AFGHANISTAN 0x01 +#define SUBLANG_DIVEHI_MALDIVES 0x01 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ESTONIAN_ESTONIA 0x01 +#define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 +#define SUBLANG_FILIPINO_PHILIPPINES 0x01 +#define SUBLANG_FINNISH_FINLAND 0x01 +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRISIAN_NETHERLANDS 0x01 +#define SUBLANG_GALICIAN_GALICIAN 0x01 +#define SUBLANG_GEORGIAN_GEORGIA 0x01 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GREEK_GREECE 0x01 +#define SUBLANG_GREENLANDIC_GREENLAND 0x01 +#define SUBLANG_GUJARATI_INDIA 0x01 +#define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 +#define SUBLANG_HEBREW_ISRAEL 0x01 +#define SUBLANG_HINDI_INDIA 0x01 +#define SUBLANG_HUNGARIAN_HUNGARY 0x01 +#define SUBLANG_ICELANDIC_ICELAND 0x01 +#define SUBLANG_IGBO_NIGERIA 0x01 +#define SUBLANG_INDONESIAN_INDONESIA 0x01 +#define SUBLANG_INUKTITUT_CANADA 0x01 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_JAPANESE_JAPAN 0x01 +#define SUBLANG_KANNADA_INDIA 0x01 +#define SUBLANG_KAZAK_KAZAKHSTAN 0x01 +#define SUBLANG_KHMER_CAMBODIA 0x01 +#define SUBLANG_KICHE_GUATEMALA 0x01 +#define SUBLANG_KINYARWANDA_RWANDA 0x01 +#define SUBLANG_KONKANI_INDIA 0x01 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 +#define SUBLANG_LAO_LAO 0x01 +#define SUBLANG_LATVIAN_LATVIA 0x01 +#define SUBLANG_LITHUANIAN 0x01 +#define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 +#define SUBLANG_MACEDONIAN_MACEDONIA 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAYALAM_INDIA 0x01 +#define SUBLANG_MALTESE_MALTA 0x01 +#define SUBLANG_MAORI_NEW_ZEALAND 0x01 +#define SUBLANG_MAPUDUNGUN_CHILE 0x01 +#define SUBLANG_MARATHI_INDIA 0x01 +#define SUBLANG_MOHAWK_MOHAWK 0x01 +#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 +#define SUBLANG_NEPALI_NEPAL 0x01 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_OCCITAN_FRANCE 0x01 +#define SUBLANG_ORIYA_INDIA 0x01 +#define SUBLANG_PASHTO_AFGHANISTAN 0x01 +#define SUBLANG_PERSIAN_IRAN 0x01 +#define SUBLANG_POLISH_POLAND 0x01 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_PUNJABI_INDIA 0x01 +#define SUBLANG_QUECHUA_BOLIVIA 0x01 +#define SUBLANG_ROMANIAN_ROMANIA 0x01 +#define SUBLANG_ROMANSH_SWITZERLAND 0x01 +#define SUBLANG_RUSSIAN_RUSSIA 0x01 +#define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 +#define SUBLANG_SANSKRIT_INDIA 0x01 +#define SUBLANG_SERBIAN_CROATIA 0x01 +#define SUBLANG_SINDHI_INDIA 0x01 +#define SUBLANG_SINHALESE_SRI_LANKA 0x01 +#define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01 +#define SUBLANG_SLOVAK_SLOVAKIA 0x01 +#define SUBLANG_SLOVENIAN_SLOVENIA 0x01 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SWAHILI_KENYA 0x01 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SYRIAC_SYRIA 0x01 +#define SUBLANG_TAJIK_TAJIKISTAN 0x01 +#define SUBLANG_TAMIL_INDIA 0x01 +#define SUBLANG_TATAR_RUSSIA 0x01 +#define SUBLANG_TELUGU_INDIA 0x01 +#define SUBLANG_THAI_THAILAND 0x01 +#define SUBLANG_TIBETAN_PRC 0x01 +#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 +#define SUBLANG_TURKISH_TURKEY 0x01 +#define SUBLANG_TURKMEN_TURKMENISTAN 0x01 +#define SUBLANG_UIGHUR_PRC 0x01 +#define SUBLANG_UKRAINIAN_UKRAINE 0x01 +#define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_VIETNAMESE_VIETNAM 0x01 +#define SUBLANG_WELSH_UNITED_KINGDOM 0x01 +#define SUBLANG_WOLOF_SENEGAL 0x01 +#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 +#define SUBLANG_YAKUT_RUSSIA 0x01 +#define SUBLANG_YI_PRC 0x01 +#define SUBLANG_YORUBA_NIGERIA 0x01 +#define SUBLANG_ZULU_SOUTH_AFRICA 0x01 +#define SORT_INVARIANT_MATH 0x1 +#define SORT_JAPANESE_UNICODE 0x1 +#define SORT_CHINESE_UNICODE 0x1 +#define SORT_KOREAN_UNICODE 0x1 +#define SORT_GERMAN_PHONE_BOOK 0x1 +#define SORT_HUNGARIAN_TECHNICAL 0x1 +#define SORT_GEORGIAN_MODERN 0x1 +#define VS_VERSION_INFO 1 +#define VFFF_ISSHAREDFILE 0x0001 +#define VFF_CURNEDEST 0x0001 +#define VIFF_FORCEINSTALL 0x0001 +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 +#define SW_SHOWMINIMIZED 2 +#define SHOW_ICONWINDOW 2 +#define SW_OTHERZOOM 2 +#define VK_RBUTTON 0x02 +#define WM_DESTROY 0x0002 +#define WA_CLICKACTIVE 2 +#define PWR_SUSPENDRESUME 2 +#define NFR_UNICODE 2 +#define UIS_CLEAR 2 +#define UISF_HIDEACCEL 0x2 +#define XBUTTON2 0x0002 +#define WMSZ_RIGHT 2 +#define HTCAPTION 2 +#define SMTO_ABORTIFHUNG 0x0002 +#define MA_ACTIVATEANDEAT 2 +#define ICON_SMALL2 2 +#define SIZE_MAXIMIZED 2 +#define MK_RBUTTON 0x0002 +#define TME_LEAVE 0x00000002 +#define CS_HREDRAW 0x0002 +#define CF_BITMAP 2 +#define IDCANCEL 2 +#define BN_HILITE 2 +#define BST_INDETERMINATE 0x0002 +#define HDS_BUTTONS 0x0002 +#define TBSTYLE_CHECK 0x0002 +#define TTS_NOPREFIX 0x02 +#define TBS_VERT 0x0002 +#define UDS_SETBUDDYINT 0x0002 +#define LWS_IGNORERETURN 0x0002 +#define LVS_SMALLICON 0x0002 +#define TVS_HASLINES 0x0002 +#define TVS_EX_MULTISELECT 0x0002 +#define TCS_BOTTOM 0x0002 +#define TCS_RIGHT 0x0002 +#define ACS_TRANSPARENT 0x0002 +#define MCS_MULTISELECT 0x0002 +#define DTS_SHOWNONE 0x0002 +#define PGS_AUTOSCROLL 0x00000002 +#define NFS_STATIC 0x0002 +#define BCSIF_IMAGE 0x0002 +#define BCSS_STRETCH 0x0002 +#define LANG_BULGARIAN 0x02 +#define SUBLANG_SYS_DEFAULT 0x02 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_BENGALI_BANGLADESH 0x02 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 +#define SUBLANG_IRISH_IRELAND 0x02 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_MONGOLIAN_PRC 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_QUECHUA_ECUADOR 0x02 +#define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SINDHI_PAKISTAN 0x02 +#define SUBLANG_SINDHI_AFGHANISTAN 0x02 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 +#define SUBLANG_TIGRIGNA_ERITREA 0x02 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_CYRILLIC 0x02 +#define SORT_CHINESE_PRC 0x2 +#define VFF_FILEINUSE 0x0002 +#define VIFF_DONTDELETEOLD 0x0002 +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 +#define SW_SHOWMAXIMIZED 3 +#define SW_MAXIMIZE 3 +#define SHOW_FULLSCREEN 3 +#define SW_PARENTOPENING 3 +#define VK_CANCEL 0x03 +#define WM_MOVE 0x0003 +#define PWR_CRITICALRESUME 3 +#define NF_QUERY 3 +#define UIS_INITIALIZE 3 +#define WMSZ_TOP 3 +#define HTSYSMENU 3 +#define MA_NOACTIVATE 3 +#define SIZE_MAXSHOW 3 +#define CF_METAFILEPICT 3 +#define IDABORT 3 +#define BN_UNHILITE 3 +#define LVS_LIST 0x0003 +#define LVS_TYPEMASK 0x0003 +#define LANG_CATALAN 0x03 +#define SUBLANG_CUSTOM_DEFAULT 0x03 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_QUECHUA_PERU 0x03 +#define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SORT_CHINESE_BOPOMOFO 0x3 +#define SW_SHOWNOACTIVATE 4 +#define SHOW_OPENNOACTIVATE 4 +#define SW_OTHERUNZOOM 4 +#define VK_MBUTTON 0x04 +#define NF_REQUERY 4 +#define UISF_ACTIVE 0x4 +#define WMSZ_TOPLEFT 4 +#define HTGROWBOX 4 +#define MA_NOACTIVATEANDEAT 4 +#define SIZE_MAXHIDE 4 +#define MK_SHIFT 0x0004 +#define CF_SYLK 4 +#define IDRETRY 4 +#define BN_DISABLE 4 +#define BST_PUSHED 0x0004 +#define HDS_HOTTRACK 0x0004 +#define TBSTYLE_GROUP 0x0004 +#define TBS_TOP 0x0004 +#define TBS_LEFT 0x0004 +#define UDS_ALIGNRIGHT 0x0004 +#define PBS_VERTICAL 0x04 +#define LWS_NOPREFIX 0x0004 +#define LVS_SINGLESEL 0x0004 +#define TVS_LINESATROOT 0x0004 +#define TVS_EX_DOUBLEBUFFER 0x0004 +#define TCS_MULTISELECT 0x0004 +#define ACS_AUTOPLAY 0x0004 +#define MCS_WEEKNUMBERS 0x0004 +#define DTS_LONGDATEFORMAT 0x0004 +#define PGS_DRAGNDROP 0x00000004 +#define NFS_LISTCOMBO 0x0004 +#define BCSIF_STYLE 0x0004 +#define BCSS_ALIGNLEFT 0x0004 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x04 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x04 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_SAMI_LULE_NORWAY 0x04 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SORT_JAPANESE_RADICALSTROKE 0x4 +#define VFF_BUFFTOOSMALL 0x0004 +#define SW_SHOW 5 +#define VK_XBUTTON1 0x05 +#define WM_SIZE 0x0005 +#define WMSZ_TOPRIGHT 5 +#define HTMENU 5 +#define CF_DIF 5 +#define IDIGNORE 5 +#define BN_DOUBLECLICKED 5 +#define LANG_CZECH 0x05 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x05 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_SAMI_LULE_SWEDEN 0x05 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SW_MINIMIZE 6 +#define VK_XBUTTON2 0x06 +#define WM_ACTIVATE 0x0006 +#define WMSZ_BOTTOM 6 +#define HTHSCROLL 6 +#define CF_TIFF 6 +#define IDYES 6 +#define BN_SETFOCUS 6 +#define LANG_DANISH 0x06 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SW_SHOWMINNOACTIVE 7 +#define WM_SETFOCUS 0x0007 +#define WMSZ_BOTTOMLEFT 7 +#define HTVSCROLL 7 +#define CF_OEMTEXT 7 +#define IDNO 7 +#define BN_KILLFOCUS 7 +#define LANG_GERMAN 0x07 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SW_SHOWNA 8 +#define VK_BACK 0x08 +#define WM_KILLFOCUS 0x0008 +#define WMSZ_BOTTOMRIGHT 8 +#define HTMINBUTTON 8 +#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008 +#define MK_CONTROL 0x0008 +#define CS_DBLCLKS 0x0008 +#define CF_DIB 8 +#define IDCLOSE 8 +#define BST_FOCUS 0x0008 +#define HDS_HIDDEN 0x0008 +#define TBSTYLE_DROPDOWN 0x0008 +#define TBS_BOTH 0x0008 +#define UDS_ALIGNLEFT 0x0008 +#define PBS_MARQUEE 0x08 +#define LWS_USEVISUALSTYLE 0x0008 +#define LVS_SHOWSELALWAYS 0x0008 +#define TVS_EDITLABELS 0x0008 +#define TVS_EX_NOINDENTSTATE 0x0008 +#define TCS_FLATBUTTONS 0x0008 +#define ACS_TIMER 0x0008 +#define MCS_NOTODAYCIRCLE 0x0008 +#define NFS_BUTTON 0x0008 +#define BCSIF_SIZE 0x0008 +#define BCSS_IMAGE 0x0008 +#define LANG_GREEK 0x08 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_SAMI_SKOLT_FINLAND 0x08 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SW_RESTORE 9 +#define VK_TAB 0x09 +#define HTMAXBUTTON 9 +#define CF_PALETTE 9 +#define IDHELP 9 +#define DTS_TIMEFORMAT 0x0009 +#define LANG_ENGLISH 0x09 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_SAMI_INARI_FINLAND 0x09 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SW_SHOWDEFAULT 10 +#define WM_ENABLE 0x000A +#define HTLEFT 10 +#define CF_PENDATA 10 +#define IDTRYAGAIN 10 +#define HELP_CONTEXTMENU 0x000a +#define LANG_SPANISH 0x0a +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_SPANISH_PERU 0x0a +#define SW_FORCEMINIMIZE 11 +#define SW_MAX 11 +#define WM_SETREDRAW 0x000B +#define HTRIGHT 11 +#define CF_RIFF 11 +#define IDCONTINUE 11 +#define HELP_FINDER 0x000b +#define LANG_FINNISH 0x0b +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define VK_CLEAR 0x0C +#define WM_SETTEXT 0x000C +#define HTTOP 12 +#define CF_WAVE 12 +#define HELP_WM_HELP 0x000c +#define DTS_SHORTDATECENTURYFORMAT 0x000C +#define LANG_FRENCH 0x0c +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define VK_RETURN 0x0D +#define WM_GETTEXT 0x000D +#define HTTOPLEFT 13 +#define CF_UNICODETEXT 13 +#define HELP_SETPOPUP_POS 0x000d +#define LANG_HEBREW 0x0d +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_SPANISH_CHILE 0x0d +#define WM_GETTEXTLENGTH 0x000E +#define HTTOPRIGHT 14 +#define CF_ENHMETAFILE 14 +#define LANG_HUNGARIAN 0x0e +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define WM_PAINT 0x000F +#define HTBOTTOM 15 +#define CF_HDROP 15 +#define LANG_ICELANDIC 0x0f +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 +#define VK_SHIFT 0x10 +#define WM_CLOSE 0x0010 +#define HTBOTTOMLEFT 16 +#define WVR_ALIGNTOP 0x0010 +#define MK_MBUTTON 0x0010 +#define TME_NONCLIENT 0x00000010 +#define CF_LOCALE 16 +#define HELP_TCARD_DATA 0x0010 +#define TBSTYLE_AUTOSIZE 0x0010 +#define TTS_NOANIMATE 0x10 +#define TBS_NOTICKS 0x0010 +#define UDS_AUTOBUDDY 0x0010 +#define PBS_SMOOTHREVERSE 0x10 +#define LWS_USECUSTOMTEXT 0x0010 +#define LVS_SORTASCENDING 0x0010 +#define TVS_DISABLEDRAGDROP 0x0010 +#define TVS_EX_RICHTOOLTIP 0x0010 +#define TCS_FORCEICONLEFT 0x0010 +#define MCS_NOTODAY 0x0010 +#define DTS_APPCANPARSE 0x0010 +#define NFS_ALL 0x0010 +#define LANG_ITALIAN 0x10 +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_ENGLISH_INDIA 0x10 +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define VK_CONTROL 0x11 +#define WM_QUERYENDSESSION 0x0011 +#define HTBOTTOMRIGHT 17 +#define CF_DIBV5 17 +#define HELP_TCARD_OTHER_CALLER 0x0011 +#define LANG_JAPANESE 0x11 +#define SUBLANG_ENGLISH_MALAYSIA 0x11 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define VK_MENU 0x12 +#define WM_QUIT 0x0012 +#define HTBORDER 18 +#define CF_MAX 18 +#define LANG_KOREAN 0x12 +#define SUBLANG_ENGLISH_SINGAPORE 0x12 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define VK_PAUSE 0x13 +#define WM_QUERYOPEN 0x0013 +#define HTOBJECT 19 +#define LANG_DUTCH 0x13 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define VK_CAPITAL 0x14 +#define WM_ERASEBKGND 0x0014 +#define HTCLOSE 20 +#define LANG_NORWEGIAN 0x14 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define VK_KANA 0x15 +#define VK_HANGEUL 0x15 +#define VK_HANGUL 0x15 +#define WM_SYSCOLORCHANGE 0x0015 +#define HTHELP 21 +#define LANG_POLISH 0x15 +#define SUBLANG_SPANISH_US 0x15 +#define WM_ENDSESSION 0x0016 +#define LANG_PORTUGUESE 0x16 +#define VK_JUNJA 0x17 +#define LANG_ROMANSH 0x17 +#define RT_MANIFEST 24 +#define VK_FINAL 0x18 +#define WM_SHOWWINDOW 0x0018 +#define LANG_ROMANIAN 0x18 +#define VK_HANJA 0x19 +#define VK_KANJI 0x19 +#define LANG_RUSSIAN 0x19 +#define WM_WININICHANGE 0x001A +#define LANG_BOSNIAN 0x1a +#define LANG_CROATIAN 0x1a +#define LANG_SERBIAN 0x1a +#define VK_ESCAPE 0x1B +#define WM_DEVMODECHANGE 0x001B +#define LANG_SLOVAK 0x1b +#define VK_CONVERT 0x1C +#define WM_ACTIVATEAPP 0x001C +#define LANG_ALBANIAN 0x1c +#define VK_NONCONVERT 0x1D +#define WM_FONTCHANGE 0x001D +#define LANG_SWEDISH 0x1d +#define VK_ACCEPT 0x1E +#define WM_TIMECHANGE 0x001E +#define LANG_THAI 0x1e +#define VK_MODECHANGE 0x1F +#define WM_CANCELMODE 0x001F +#define LANG_TURKISH 0x1f +#define VK_SPACE 0x20 +#define WM_SETCURSOR 0x0020 +#define SMTO_ERRORONEXIT 0x0020 +#define WVR_ALIGNLEFT 0x0020 +#define MK_XBUTTON1 0x0020 +#define CS_OWNDC 0x0020 +#define TBSTYLE_NOPREFIX 0x0020 +#define TTS_NOFADE 0x20 +#define TBS_ENABLESELRANGE 0x0020 +#define UDS_ARROWKEYS 0x0020 +#define LWS_RIGHT 0x0020 +#define LVS_SORTDESCENDING 0x0020 +#define TVS_SHOWSELALWAYS 0x0020 +#define TVS_EX_AUTOHSCROLL 0x0020 +#define TCS_FORCELABELLEFT 0x0020 +#define DTS_RIGHTALIGN 0x0020 +#define NFS_USEFONTASSOC 0x0020 +#define LANG_URDU 0x20 +#define VK_PRIOR 0x21 +#define WM_MOUSEACTIVATE 0x0021 +#define LANG_INDONESIAN 0x21 +#define VK_NEXT 0x22 +#define WM_CHILDACTIVATE 0x0022 +#define LANG_UKRAINIAN 0x22 +#define VK_END 0x23 +#define WM_QUEUESYNC 0x0023 +#define LANG_BELARUSIAN 0x23 +#define VK_HOME 0x24 +#define WM_GETMINMAXINFO 0x0024 +#define LANG_SLOVENIAN 0x24 +#define VK_LEFT 0x25 +#define LANG_ESTONIAN 0x25 +#define VK_UP 0x26 +#define WM_PAINTICON 0x0026 +#define LANG_LATVIAN 0x26 +#define VK_RIGHT 0x27 +#define WM_ICONERASEBKGND 0x0027 +#define LANG_LITHUANIAN 0x27 +#define VK_DOWN 0x28 +#define WM_NEXTDLGCTL 0x0028 +#define LANG_TAJIK 0x28 +#define VK_SELECT 0x29 +#define LANG_FARSI 0x29 +#define LANG_PERSIAN 0x29 +#define VK_PRINT 0x2A +#define WM_SPOOLERSTATUS 0x002A +#define LANG_VIETNAMESE 0x2a +#define VK_EXECUTE 0x2B +#define WM_DRAWITEM 0x002B +#define LANG_ARMENIAN 0x2b +#define VK_SNAPSHOT 0x2C +#define WM_MEASUREITEM 0x002C +#define LANG_AZERI 0x2c +#define VK_INSERT 0x2D +#define WM_DELETEITEM 0x002D +#define LANG_BASQUE 0x2d +#define VK_DELETE 0x2E +#define WM_VKEYTOITEM 0x002E +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_UPPER_SORBIAN 0x2e +#define VK_HELP 0x2F +#define WM_CHARTOITEM 0x002F +#define LANG_MACEDONIAN 0x2f +#define WM_SETFONT 0x0030 +#define WM_GETFONT 0x0031 +#define WM_SETHOTKEY 0x0032 +#define LANG_TSWANA 0x32 +#define WM_GETHOTKEY 0x0033 +#define LANG_XHOSA 0x34 +#define LANG_ZULU 0x35 +#define LANG_AFRIKAANS 0x36 +#define WM_QUERYDRAGICON 0x0037 +#define LANG_GEORGIAN 0x37 +#define LANG_FAEROESE 0x38 +#define WM_COMPAREITEM 0x0039 +#define LANG_HINDI 0x39 +#define LANG_MALTESE 0x3a +#define LANG_SAMI 0x3b +#define LANG_IRISH 0x3c +#define WM_GETOBJECT 0x003D +#define LANG_MALAY 0x3e +#define LANG_KAZAK 0x3f +#define WVR_ALIGNBOTTOM 0x0040 +#define MK_XBUTTON2 0x0040 +#define CS_CLASSDC 0x0040 +#define HDS_DRAGDROP 0x0040 +#define BTNS_SHOWTEXT 0x0040 +#define TTS_BALLOON 0x40 +#define TBS_FIXEDLENGTH 0x0040 +#define UDS_HORZ 0x0040 +#define LVS_SHAREIMAGELISTS 0x0040 +#define TVS_RTLREADING 0x0040 +#define TVS_EX_FADEINOUTEXPANDOS 0x0040 +#define TCS_HOTTRACK 0x0040 +#define MCS_NOTRAILINGDATES 0x0040 +#define LANG_KYRGYZ 0x40 +#define WM_COMPACTING 0x0041 +#define LANG_SWAHILI 0x41 +#define LANG_TURKMEN 0x42 +#define LANG_UZBEK 0x43 +#define WM_COMMNOTIFY 0x0044 +#define LANG_TATAR 0x44 +#define LANG_BENGALI 0x45 +#define WM_WINDOWPOSCHANGING 0x0046 +#define LANG_PUNJABI 0x46 +#define WM_WINDOWPOSCHANGED 0x0047 +#define LANG_GUJARATI 0x47 +#define WM_POWER 0x0048 +#define LANG_ORIYA 0x48 +#define LANG_TAMIL 0x49 +#define WM_COPYDATA 0x004A +#define LANG_TELUGU 0x4a +#define WM_CANCELJOURNAL 0x004B +#define LANG_KANNADA 0x4b +#define LANG_MALAYALAM 0x4c +#define LANG_ASSAMESE 0x4d +#define WM_NOTIFY 0x004E +#define LANG_MARATHI 0x4e +#define LANG_SANSKRIT 0x4f +#define WM_INPUTLANGCHANGEREQUEST 0x0050 +#define LANG_MONGOLIAN 0x50 +#define WM_INPUTLANGCHANGE 0x0051 +#define LANG_TIBETAN 0x51 +#define WM_TCARD 0x0052 +#define LANG_WELSH 0x52 +#define WM_HELP 0x0053 +#define LANG_KHMER 0x53 +#define WM_USERCHANGED 0x0054 +#define LANG_LAO 0x54 +#define WM_NOTIFYFORMAT 0x0055 +#define LANG_GALICIAN 0x56 +#define LANG_KONKANI 0x57 +#define LANG_MANIPURI 0x58 +#define LANG_SINDHI 0x59 +#define LANG_SYRIAC 0x5a +#define VK_LWIN 0x5B +#define LANG_SINHALESE 0x5b +#define VK_RWIN 0x5C +#define VK_APPS 0x5D +#define LANG_INUKTITUT 0x5d +#define LANG_AMHARIC 0x5e +#define VK_SLEEP 0x5F +#define LANG_TAMAZIGHT 0x5f +#define VK_NUMPAD0 0x60 +#define LANG_KASHMIRI 0x60 +#define VK_NUMPAD1 0x61 +#define LANG_NEPALI 0x61 +#define VK_NUMPAD2 0x62 +#define LANG_FRISIAN 0x62 +#define VK_NUMPAD3 0x63 +#define LANG_PASHTO 0x63 +#define VK_NUMPAD4 0x64 +#define LANG_FILIPINO 0x64 +#define VS_USER_DEFINED 100 +#define IDD_ABOUT 101 +#define VK_NUMPAD5 0x65 +#define LANG_DIVEHI 0x65 +#define IDD_SETTINGS 102 +#define VK_NUMPAD6 0x66 +#define IDD_DEBUGGER 103 +#define VK_NUMPAD7 0x67 +#define IDD_ADVANCED 104 +#define VK_NUMPAD8 0x68 +#define LANG_HAUSA 0x68 +#define IDD_ENHANCEMENTS 105 +#define VK_NUMPAD9 0x69 +#define VK_MULTIPLY 0x6A +#define LANG_YORUBA 0x6a +#define VK_ADD 0x6B +#define LANG_QUECHUA 0x6b +#define VK_SEPARATOR 0x6C +#define LANG_SOTHO 0x6c +#define VK_SUBTRACT 0x6D +#define LANG_BASHKIR 0x6d +#define VK_DECIMAL 0x6E +#define LANG_LUXEMBOURGISH 0x6e +#define VK_DIVIDE 0x6F +#define LANG_GREENLANDIC 0x6f +#define VK_F1 0x70 +#define LANG_IGBO 0x70 +#define VK_F2 0x71 +#define VK_F3 0x72 +#define VK_F4 0x73 +#define LANG_TIGRIGNA 0x73 +#define VK_F5 0x74 +#define VK_F6 0x75 +#define VK_F7 0x76 +#define VK_F8 0x77 +#define VK_F9 0x78 +#define WHEEL_DELTA 120 +#define LANG_YI 0x78 +#define VK_F10 0x79 +#define VK_F11 0x7A +#define LANG_MAPUDUNGUN 0x7a +#define VK_F12 0x7B +#define WM_CONTEXTMENU 0x007B +#define VK_F13 0x7C +#define WM_STYLECHANGING 0x007C +#define LANG_MOHAWK 0x7c +#define VK_F14 0x7D +#define WM_STYLECHANGED 0x007D +#define VK_F15 0x7E +#define WM_DISPLAYCHANGE 0x007E +#define LANG_BRETON 0x7e +#define VK_F16 0x7F +#define WM_GETICON 0x007F +#define LANG_INVARIANT 0x7f +#define VK_F17 0x80 +#define WM_SETICON 0x0080 +#define WVR_ALIGNRIGHT 0x0080 +#define CS_PARENTDC 0x0080 +#define CF_OWNERDISPLAY 0x0080 +#define HDS_FULLDRAG 0x0080 +#define BTNS_WHOLEDROPDOWN 0x0080 +#define TTS_CLOSE 0x80 +#define TBS_NOTHUMB 0x0080 +#define UDS_NOTHOUSANDS 0x0080 +#define LVS_NOLABELWRAP 0x0080 +#define TVS_NOTOOLTIPS 0x0080 +#define TVS_EX_PARTIALCHECKBOXES 0x0080 +#define TCS_VERTICAL 0x0080 +#define MCS_SHORTDAYSOFWEEK 0x0080 +#define LANG_UIGHUR 0x80 +#define VK_F18 0x81 +#define WM_NCCREATE 0x0081 +#define CF_DSPTEXT 0x0081 +#define LANG_MAORI 0x81 +#define VK_F19 0x82 +#define WM_NCDESTROY 0x0082 +#define CF_DSPBITMAP 0x0082 +#define LANG_OCCITAN 0x82 +#define VK_F20 0x83 +#define WM_NCCALCSIZE 0x0083 +#define CF_DSPMETAFILEPICT 0x0083 +#define LANG_CORSICAN 0x83 +#define VK_F21 0x84 +#define WM_NCHITTEST 0x0084 +#define LANG_ALSATIAN 0x84 +#define VK_F22 0x85 +#define WM_NCPAINT 0x0085 +#define LANG_YAKUT 0x85 +#define VK_F23 0x86 +#define WM_NCACTIVATE 0x0086 +#define LANG_KICHE 0x86 +#define VK_F24 0x87 +#define WM_GETDLGCODE 0x0087 +#define LANG_KINYARWANDA 0x87 +#define WM_SYNCPAINT 0x0088 +#define LANG_WOLOF 0x88 +#define LANG_DARI 0x8c +#define CF_DSPENHMETAFILE 0x008E +#define VK_NUMLOCK 0x90 +#define VK_SCROLL 0x91 +#define VK_OEM_NEC_EQUAL 0x92 +#define VK_OEM_FJ_JISHO 0x92 +#define VK_OEM_FJ_MASSHOU 0x93 +#define VK_OEM_FJ_TOUROKU 0x94 +#define VK_OEM_FJ_LOYA 0x95 +#define VK_OEM_FJ_ROYA 0x96 +#define VK_LSHIFT 0xA0 +#define WM_NCMOUSEMOVE 0x00A0 +#define VK_RSHIFT 0xA1 +#define WM_NCLBUTTONDOWN 0x00A1 +#define VK_LCONTROL 0xA2 +#define WM_NCLBUTTONUP 0x00A2 +#define VK_RCONTROL 0xA3 +#define WM_NCLBUTTONDBLCLK 0x00A3 +#define VK_LMENU 0xA4 +#define WM_NCRBUTTONDOWN 0x00A4 +#define VK_RMENU 0xA5 +#define WM_NCRBUTTONUP 0x00A5 +#define VK_BROWSER_BACK 0xA6 +#define WM_NCRBUTTONDBLCLK 0x00A6 +#define VK_BROWSER_FORWARD 0xA7 +#define WM_NCMBUTTONDOWN 0x00A7 +#define VK_BROWSER_REFRESH 0xA8 +#define WM_NCMBUTTONUP 0x00A8 +#define VK_BROWSER_STOP 0xA9 +#define WM_NCMBUTTONDBLCLK 0x00A9 +#define VK_BROWSER_SEARCH 0xAA +#define VK_BROWSER_FAVORITES 0xAB +#define WM_NCXBUTTONDOWN 0x00AB +#define VK_BROWSER_HOME 0xAC +#define WM_NCXBUTTONUP 0x00AC +#define VK_VOLUME_MUTE 0xAD +#define WM_NCXBUTTONDBLCLK 0x00AD +#define VK_VOLUME_DOWN 0xAE +#define VK_VOLUME_UP 0xAF +#define VK_MEDIA_NEXT_TRACK 0xB0 +#define EM_GETSEL 0x00B0 +#define VK_MEDIA_PREV_TRACK 0xB1 +#define EM_SETSEL 0x00B1 +#define VK_MEDIA_STOP 0xB2 +#define EM_GETRECT 0x00B2 +#define VK_MEDIA_PLAY_PAUSE 0xB3 +#define EM_SETRECT 0x00B3 +#define VK_LAUNCH_MAIL 0xB4 +#define EM_SETRECTNP 0x00B4 +#define VK_LAUNCH_MEDIA_SELECT 0xB5 +#define EM_SCROLL 0x00B5 +#define VK_LAUNCH_APP1 0xB6 +#define EM_LINESCROLL 0x00B6 +#define VK_LAUNCH_APP2 0xB7 +#define EM_SCROLLCARET 0x00B7 +#define EM_GETMODIFY 0x00B8 +#define EM_SETMODIFY 0x00B9 +#define VK_OEM_1 0xBA +#define EM_GETLINECOUNT 0x00BA +#define VK_OEM_PLUS 0xBB +#define EM_LINEINDEX 0x00BB +#define VK_OEM_COMMA 0xBC +#define EM_SETHANDLE 0x00BC +#define VK_OEM_MINUS 0xBD +#define EM_GETHANDLE 0x00BD +#define VK_OEM_PERIOD 0xBE +#define EM_GETTHUMB 0x00BE +#define VK_OEM_2 0xBF +#define VK_OEM_3 0xC0 +#define EM_LINELENGTH 0x00C1 +#define EM_REPLACESEL 0x00C2 +#define EM_GETLINE 0x00C4 +#define EM_LIMITTEXT 0x00C5 +#define EM_CANUNDO 0x00C6 +#define EM_UNDO 0x00C7 +#define EM_FMTLINES 0x00C8 +#define EM_LINEFROMCHAR 0x00C9 +#define EM_SETTABSTOPS 0x00CB +#define EM_SETPASSWORDCHAR 0x00CC +#define EM_EMPTYUNDOBUFFER 0x00CD +#define EM_GETFIRSTVISIBLELINE 0x00CE +#define EM_SETREADONLY 0x00CF +#define EM_SETWORDBREAKPROC 0x00D0 +#define EM_GETWORDBREAKPROC 0x00D1 +#define EM_GETPASSWORDCHAR 0x00D2 +#define EM_SETMARGINS 0x00D3 +#define EM_GETMARGINS 0x00D4 +#define EM_GETLIMITTEXT 0x00D5 +#define EM_POSFROMCHAR 0x00D6 +#define EM_CHARFROMPOS 0x00D7 +#define EM_SETIMESTATUS 0x00D8 +#define EM_GETIMESTATUS 0x00D9 +#define VK_OEM_4 0xDB +#define VK_OEM_5 0xDC +#define VK_OEM_6 0xDD +#define VK_OEM_7 0xDE +#define VK_OEM_8 0xDF +#define VK_OEM_AX 0xE1 +#define VK_OEM_102 0xE2 +#define VK_ICO_HELP 0xE3 +#define VK_ICO_00 0xE4 +#define VK_PROCESSKEY 0xE5 +#define VK_ICO_CLEAR 0xE6 +#define VK_PACKET 0xE7 +#define VK_OEM_RESET 0xE9 +#define VK_OEM_JUMP 0xEA +#define VK_OEM_PA1 0xEB +#define VK_OEM_PA2 0xEC +#define VK_OEM_PA3 0xED +#define VK_OEM_WSCTRL 0xEE +#define VK_OEM_CUSEL 0xEF +#define VK_OEM_ATTN 0xF0 +#define BM_GETCHECK 0x00F0 +#define VK_OEM_FINISH 0xF1 +#define BM_SETCHECK 0x00F1 +#define VK_OEM_COPY 0xF2 +#define BM_GETSTATE 0x00F2 +#define VK_OEM_AUTO 0xF3 +#define BM_SETSTATE 0x00F3 +#define VK_OEM_ENLW 0xF4 +#define BM_SETSTYLE 0x00F4 +#define VK_OEM_BACKTAB 0xF5 +#define BM_CLICK 0x00F5 +#define VK_ATTN 0xF6 +#define BM_GETIMAGE 0x00F6 +#define VK_CRSEL 0xF7 +#define BM_SETIMAGE 0x00F7 +#define VK_EXSEL 0xF8 +#define BM_SETDONTCLICK 0x00F8 +#define VK_EREOF 0xF9 +#define VK_PLAY 0xFA +#define VK_ZOOM 0xFB +#define VK_NONAME 0xFC +#define VK_PA1 0xFD +#define VK_OEM_CLEAR 0xFE +#define WM_INPUT_DEVICE_CHANGE 0x00FE +#define SUBVERSION_MASK 0x000000FF +#define WM_INPUT 0x00FF +#define WM_KEYFIRST 0x0100 +#define WM_KEYDOWN 0x0100 +#define WVR_HREDRAW 0x0100 +#define HDS_FILTERBAR 0x0100 +#define TBSTYLE_TOOLTIPS 0x0100 +#define RBS_TOOLTIPS 0x00000100 +#define TTS_USEVISUALSTYLE 0x100 +#define SBARS_SIZEGRIP 0x0100 +#define TBS_TOOLTIPS 0x0100 +#define UDS_HOTTRACK 0x0100 +#define LVS_AUTOARRANGE 0x0100 +#define TVS_CHECKBOXES 0x0100 +#define TVS_EX_EXCLUSIONCHECKBOXES 0x0100 +#define TCS_BUTTONS 0x0100 +#define MCS_NOSELCHANGEONNAV 0x0100 +#define WM_KEYUP 0x0101 +#define WM_CHAR 0x0102 +#define WM_DEADCHAR 0x0103 +#define WM_SYSKEYDOWN 0x0104 +#define WM_SYSKEYUP 0x0105 +#define WM_SYSCHAR 0x0106 +#define WM_SYSDEADCHAR 0x0107 +#define WM_UNICHAR 0x0109 +#define WM_KEYLAST 0x0109 +#define WM_IME_STARTCOMPOSITION 0x010D +#define WM_IME_ENDCOMPOSITION 0x010E +#define WM_IME_COMPOSITION 0x010F +#define WM_IME_KEYLAST 0x010F +#define WM_INITDIALOG 0x0110 +#define WM_COMMAND 0x0111 +#define WM_SYSCOMMAND 0x0112 +#define WM_TIMER 0x0113 +#define WM_HSCROLL 0x0114 +#define WM_VSCROLL 0x0115 +#define WM_INITMENU 0x0116 +#define WM_INITMENUPOPUP 0x0117 +#define WM_MENUSELECT 0x011F +#define WM_MENUCHAR 0x0120 +#define WM_ENTERIDLE 0x0121 +#define WM_MENURBUTTONUP 0x0122 +#define WM_MENUDRAG 0x0123 +#define WM_MENUGETOBJECT 0x0124 +#define WM_UNINITMENUPOPUP 0x0125 +#define WM_MENUCOMMAND 0x0126 +#define WM_CHANGEUISTATE 0x0127 +#define WM_UPDATEUISTATE 0x0128 +#define WM_QUERYUISTATE 0x0129 +#define WM_CTLCOLORMSGBOX 0x0132 +#define WM_CTLCOLOREDIT 0x0133 +#define WM_CTLCOLORLISTBOX 0x0134 +#define WM_CTLCOLORBTN 0x0135 +#define WM_CTLCOLORDLG 0x0136 +#define WM_CTLCOLORSCROLLBAR 0x0137 +#define WM_CTLCOLORSTATIC 0x0138 +#define MN_GETHMENU 0x01E1 +#define _WIN32_IE_IE20 0x0200 +#define WM_MOUSEFIRST 0x0200 +#define WM_MOUSEMOVE 0x0200 +#define WVR_VREDRAW 0x0200 +#define CS_NOCLOSE 0x0200 +#define CF_PRIVATEFIRST 0x0200 +#define HDS_FLAT 0x0200 +#define TBSTYLE_WRAPABLE 0x0200 +#define RBS_VARHEIGHT 0x00000200 +#define TBS_REVERSED 0x0200 +#define LVS_EDITLABELS 0x0200 +#define TVS_TRACKSELECT 0x0200 +#define TVS_EX_DIMMEDCHECKBOXES 0x0200 +#define TCS_MULTILINE 0x0200 +#define WM_LBUTTONDOWN 0x0201 +#define WM_LBUTTONUP 0x0202 +#define WM_LBUTTONDBLCLK 0x0203 +#define WM_RBUTTONDOWN 0x0204 +#define WM_RBUTTONUP 0x0205 +#define WM_RBUTTONDBLCLK 0x0206 +#define WM_MBUTTONDOWN 0x0207 +#define WM_MBUTTONUP 0x0208 +#define WM_MBUTTONDBLCLK 0x0209 +#define WM_MOUSEWHEEL 0x020A +#define WM_XBUTTONDOWN 0x020B +#define WM_XBUTTONUP 0x020C +#define WM_XBUTTONDBLCLK 0x020D +#define WM_MOUSEHWHEEL 0x020E +#define WM_MOUSELAST 0x020E +#define WM_PARENTNOTIFY 0x0210 +#define WM_ENTERMENULOOP 0x0211 +#define WM_EXITMENULOOP 0x0212 +#define WM_NEXTMENU 0x0213 +#define WM_SIZING 0x0214 +#define WM_CAPTURECHANGED 0x0215 +#define WM_MOVING 0x0216 +#define WM_POWERBROADCAST 0x0218 +#define WM_DEVICECHANGE 0x0219 +#define WM_MDICREATE 0x0220 +#define WM_MDIDESTROY 0x0221 +#define WM_MDIACTIVATE 0x0222 +#define WM_MDIRESTORE 0x0223 +#define WM_MDINEXT 0x0224 +#define WM_MDIMAXIMIZE 0x0225 +#define WM_MDITILE 0x0226 +#define WM_MDICASCADE 0x0227 +#define WM_MDIICONARRANGE 0x0228 +#define WM_MDIGETACTIVE 0x0229 +#define WM_MDISETMENU 0x0230 +#define WM_ENTERSIZEMOVE 0x0231 +#define WM_EXITSIZEMOVE 0x0232 +#define WM_DROPFILES 0x0233 +#define WM_MDIREFRESHMENU 0x0234 +#define WM_IME_SETCONTEXT 0x0281 +#define WM_IME_NOTIFY 0x0282 +#define WM_IME_CONTROL 0x0283 +#define WM_IME_COMPOSITIONFULL 0x0284 +#define WM_IME_SELECT 0x0285 +#define WM_IME_CHAR 0x0286 +#define WM_IME_REQUEST 0x0288 +#define WM_IME_KEYDOWN 0x0290 +#define WM_IME_KEYUP 0x0291 +#define WM_NCMOUSEHOVER 0x02A0 +#define WM_MOUSEHOVER 0x02A1 +#define WM_NCMOUSELEAVE 0x02A2 +#define WM_MOUSELEAVE 0x02A3 +#define WM_WTSSESSION_CHANGE 0x02B1 +#define WM_TABLET_FIRST 0x02c0 +#define WM_TABLET_LAST 0x02df +#define CF_PRIVATELAST 0x02FF +#define _WIN32_IE_IE30 0x0300 +#define WM_CUT 0x0300 +#define CF_GDIOBJFIRST 0x0300 +#define WM_COPY 0x0301 +#define _WIN32_IE_IE302 0x0302 +#define WM_PASTE 0x0302 +#define WM_CLEAR 0x0303 +#define WM_UNDO 0x0304 +#define WM_RENDERFORMAT 0x0305 +#define WM_RENDERALLFORMATS 0x0306 +#define WM_DESTROYCLIPBOARD 0x0307 +#define WM_DRAWCLIPBOARD 0x0308 +#define WM_PAINTCLIPBOARD 0x0309 +#define WM_VSCROLLCLIPBOARD 0x030A +#define WM_SIZECLIPBOARD 0x030B +#define WM_ASKCBFORMATNAME 0x030C +#define WM_CHANGECBCHAIN 0x030D +#define WM_HSCROLLCLIPBOARD 0x030E +#define WM_QUERYNEWPALETTE 0x030F +#define WM_PALETTEISCHANGING 0x0310 +#define WM_PALETTECHANGED 0x0311 +#define WM_HOTKEY 0x0312 +#define WM_PRINT 0x0317 +#define WM_PRINTCLIENT 0x0318 +#define WM_APPCOMMAND 0x0319 +#define WM_THEMECHANGED 0x031A +#define WM_CLIPBOARDUPDATE 0x031D +#define WM_DWMCOMPOSITIONCHANGED 0x031E +#define WM_DWMNCRENDERINGCHANGED 0x031F +#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 +#define WM_DWMWINDOWMAXIMIZEDCHANGE 0x0321 +#define WM_GETTITLEBARINFOEX 0x033F +#define WM_HANDHELDFIRST 0x0358 +#define WM_HANDHELDLAST 0x035F +#define WM_AFXFIRST 0x0360 +#define WM_AFXLAST 0x037F +#define WM_PENWINFIRST 0x0380 +#define WM_PENWINLAST 0x038F +#define WM_DDE_FIRST 0x03E0 +#define IDC_ENABLETEXTURING 1001 +#define IDC_CHECK2 1002 +#define IDC_WIREFRAME 1002 +#define IDC_USESHADERS 1002 +#define IDC_FORCEANISOTROPY 1002 +#define IDC_FULLSCREENENABLE 1002 +#define IDC_LIST1 1003 +#define IDC_FULLSCREENENABLE2 1003 +#define IDC_VSYNC 1003 +#define IDC_DEBUGSTEP 1004 +#define IDC_RENDER_TO_MAINWINDOW 1004 +#define IDC_REGISTERS 1005 +#define IDC_ENABLEDEBUGGING 1006 +#define IDC_TAB1 1007 +#define IDC_REGISTERSELECT 1007 +#define IDC_ADAPTER 1008 +#define IDC_DEVICE 1009 +#define IDC_RESOLUTION 1010 +#define IDC_RESOLUTIONWINDOWED 1011 +#define IDC_ANTIALIASMODE 1012 +#define IDC_PPPARAM1 1013 +#define IDC_SHADERVERSION 1013 +#define IDC_PPPARAM2 1014 +#define IDC_CHECK1 1015 +#define IDC_POSTPROCESS 1016 +#define IDC_TRUFORM 1016 +#define IDC_PPPARAM1LABEL 1017 +#define IDC_POSTPROCESSEFFECT 1017 +#define IDC_PPPARAM2LABEL 1018 +#define IDC_PPPARAM1LABEL2 1018 +#define IDC_ANTIALIASQUALITY 1019 +#define IDC_ENABLEPOSTPROCESS 1020 +#define IDC_ANIMATE1 1021 +#define IDC_OVERLAYSTATS 1022 +#define IDC_DLOPTLEVEL 1023 +#define CF_GDIOBJLAST 0x03FF +#define IDC_PREUPSCALETYPE 1024 +#define _WIN32_WINNT_NT4 0x0400 +#define _WIN32_IE_IE40 0x0400 +#define WM_USER 0x0400 +#define WVR_VALIDRECTS 0x0400 +#define HDS_CHECKBOXES 0x0400 +#define TBSTYLE_ALTDRAG 0x0400 +#define RBS_BANDBORDERS 0x00000400 +#define TBS_DOWNISLEFT 0x0400 +#define LVS_OWNERDRAWFIXED 0x0400 +#define TVS_SINGLEEXPAND 0x0400 +#define TVS_EX_DRAWIMAGEASYNC 0x0400 +#define TCS_FIXEDWIDTH 0x0400 +#define ctlFirst 0x0400 +#define psh1 0x0400 +#define IDC_TRUFORMLEVEL 1025 +#define _WIN32_IE_IE401 0x0401 +#define psh2 0x0401 +#define IDC_PREUPSCALE 1026 +#define psh3 0x0402 +#define IDC_SLIDER1 1027 +#define psh4 0x0403 +#define IDC_TEXDUMPPATH 1028 +#define psh5 0x0404 +#define IDC_TEXDUMP 1029 +#define psh6 0x0405 +#define IDC_FORCEFILTERING 1030 +#define psh7 0x0406 +#define IDC_BROWSETEXDUMPPATH 1031 +#define psh8 0x0407 +#define psh9 0x0408 +#define IDC_SHOWSHADERERRORS 1033 +#define psh10 0x0409 +#define IDC_CHECK3 1034 +#define IDC_TEXFMT_CENTER 1034 +#define psh11 0x040a +#define IDC_ASPECT_4_3 1034 +#define IDC_TEXFMT_OVERLAY 1035 +#define psh12 0x040b +#define IDC_ASPECT_16_9 1035 +#define IDC_OVERLAYPROJSTATS 1036 +#define psh13 0x040c +#define IDC_CHECK4 1036 +#define IDC_WIDESCREEN_HACK 1036 +#define IDC_DUMPFRAMES 1037 +#define psh14 0x040d +#define IDC_ASPECT_16_10 1037 +#define IDC_SAFE_TEXTURE_CACHE 1037 +#define psh15 0x040e +#define IDC_EFBACCESSENABLE 1038 +#define IDC_EFB_ACCESS_ENABLE 1038 +#define psh16 0x040f +#define _WIN32_WINDOWS 0x0410 +#define chx1 0x0410 +#define chx2 0x0411 +#define chx3 0x0412 +#define chx4 0x0413 +#define chx5 0x0414 +#define chx6 0x0415 +#define chx7 0x0416 +#define chx8 0x0417 +#define chx9 0x0418 +#define chx10 0x0419 +#define chx11 0x041a +#define chx12 0x041b +#define chx13 0x041c +#define chx14 0x041d +#define chx15 0x041e +#define chx16 0x041f +#define rad1 0x0420 +#define rad2 0x0421 +#define rad3 0x0422 +#define rad4 0x0423 +#define rad5 0x0424 +#define rad6 0x0425 +#define rad7 0x0426 +#define rad8 0x0427 +#define rad9 0x0428 +#define rad10 0x0429 +#define rad11 0x042a +#define rad12 0x042b +#define rad13 0x042c +#define rad14 0x042d +#define rad15 0x042e +#define rad16 0x042f +#define grp1 0x0430 +#define grp2 0x0431 +#define grp3 0x0432 +#define grp4 0x0433 +#define frm1 0x0434 +#define frm2 0x0435 +#define frm3 0x0436 +#define frm4 0x0437 +#define rct1 0x0438 +#define rct2 0x0439 +#define rct3 0x043a +#define rct4 0x043b +#define ico1 0x043c +#define ico2 0x043d +#define ico3 0x043e +#define ico4 0x043f +#define stc1 0x0440 +#define stc2 0x0441 +#define stc3 0x0442 +#define stc4 0x0443 +#define stc5 0x0444 +#define stc6 0x0445 +#define stc7 0x0446 +#define stc8 0x0447 +#define stc9 0x0448 +#define stc10 0x0449 +#define stc11 0x044a +#define stc12 0x044b +#define stc13 0x044c +#define stc14 0x044d +#define stc15 0x044e +#define stc16 0x044f +#define stc17 0x0450 +#define stc18 0x0451 +#define stc19 0x0452 +#define stc20 0x0453 +#define stc21 0x0454 +#define stc22 0x0455 +#define stc23 0x0456 +#define stc24 0x0457 +#define stc25 0x0458 +#define stc26 0x0459 +#define stc27 0x045a +#define stc28 0x045b +#define stc29 0x045c +#define stc30 0x045d +#define stc31 0x045e +#define stc32 0x045f +#define lst1 0x0460 +#define lst2 0x0461 +#define lst3 0x0462 +#define lst4 0x0463 +#define lst5 0x0464 +#define lst6 0x0465 +#define lst7 0x0466 +#define lst8 0x0467 +#define lst9 0x0468 +#define lst10 0x0469 +#define lst11 0x046a +#define lst12 0x046b +#define lst13 0x046c +#define lst14 0x046d +#define lst15 0x046e +#define lst16 0x046f +#define cmb1 0x0470 +#define cmb2 0x0471 +#define cmb3 0x0472 +#define cmb4 0x0473 +#define cmb5 0x0474 +#define cmb6 0x0475 +#define cmb7 0x0476 +#define cmb8 0x0477 +#define cmb9 0x0478 +#define cmb10 0x0479 +#define cmb11 0x047a +#define cmb12 0x047b +#define cmb13 0x047c +#define cmb14 0x047d +#define cmb15 0x047e +#define cmb16 0x047f +#define edt1 0x0480 +#define edt2 0x0481 +#define edt3 0x0482 +#define edt4 0x0483 +#define edt5 0x0484 +#define edt6 0x0485 +#define edt7 0x0486 +#define edt8 0x0487 +#define edt9 0x0488 +#define edt10 0x0489 +#define edt11 0x048a +#define edt12 0x048b +#define edt13 0x048c +#define edt14 0x048d +#define edt15 0x048e +#define edt16 0x048f +#define scr1 0x0490 +#define scr2 0x0491 +#define scr3 0x0492 +#define scr4 0x0493 +#define scr5 0x0494 +#define scr6 0x0495 +#define scr7 0x0496 +#define scr8 0x0497 +#define ctl1 0x04A0 +#define ctlLast 0x04ff +#define _WIN32_WINNT_WIN2K 0x0500 +#define _WIN32_IE_IE50 0x0500 +#define _WIN32_WINNT_WINXP 0x0501 +#define _WIN32_IE_IE501 0x0501 +#define _WIN32_WINNT_WS03 0x0502 +#define _WIN32_IE_IE55 0x0550 +#define _WIN32_WINNT_LONGHORN 0x0600 +#define _WIN32_IE_IE60 0x0600 +#define _WIN32_WINNT 0x0600 +#define FILEOPENORD 1536 +#define _WIN32_IE_IE60SP1 0x0601 +#define MULTIFILEOPENORD 1537 +#define _WIN32_IE_WS03 0x0602 +#define PRINTDLGORD 1538 +#define _WIN32_IE_IE60SP2 0x0603 +#define PRNSETUPDLGORD 1539 +#define FINDDLGORD 1540 +#define REPLACEDLGORD 1541 +#define FONTDLGORD 1542 +#define FORMATDLGORD31 1543 +#define FORMATDLGORD30 1544 +#define RUNDLGORD 1545 +#define PAGESETUPDLGORD 1546 +#define NEWFILEOPENORD 1547 +#define PRINTDLGEXORD 1549 +#define PAGESETUPDLGORDMOTIF 1550 +#define COLORMGMTDLGORD 1551 +#define NEWFILEOPENV2ORD 1552 +#define NEWFILEOPENV3ORD 1553 +#define _WIN32_IE_IE70 0x0700 +#define _WIN32_IE 0x0700 +#define CS_SAVEBITS 0x0800 +#define HDS_NOSIZING 0x0800 +#define TBSTYLE_FLAT 0x0800 +#define RBS_FIXEDORDER 0x00000800 +#define SBARS_TOOLTIPS 0x0800 +#define SBT_TOOLTIPS 0x0800 +#define TBS_NOTIFYBEFOREMOVE 0x0800 +#define LVS_ALIGNLEFT 0x0800 +#define TVS_INFOTIP 0x0800 +#define TCS_RAGGEDRIGHT 0x0800 +#define LVS_ALIGNMASK 0x0c00 +#define CS_BYTEALIGNCLIENT 0x1000 +#define HDS_OVERFLOW 0x1000 +#define TBSTYLE_LIST 0x1000 +#define RBS_REGISTERDROP 0x00001000 +#define TBS_TRANSPARENTBKGND 0x1000 +#define LVS_OWNERDATA 0x1000 +#define TVS_FULLROWSELECT 0x1000 +#define TCS_FOCUSONBUTTONDOWN 0x1000 +#define CS_BYTEALIGNWINDOW 0x2000 +#define TBSTYLE_CUSTOMERASE 0x2000 +#define RBS_AUTOSIZE 0x00002000 +#define LVS_NOSCROLL 0x2000 +#define TVS_NOSCROLL 0x2000 +#define TCS_OWNERDRAWFIXED 0x2000 +#define CS_GLOBALCLASS 0x4000 +#define TBSTYLE_REGISTERDROP 0x4000 +#define RBS_VERTICALGRIPPER 0x00004000 +#define LVS_NOCOLUMNHEADER 0x4000 +#define TVS_NONEVENHEIGHT 0x4000 +#define TCS_TOOLTIPS 0x4000 +#define IDH_NO_HELP 28440 +#define IDH_MISSING_CONTEXT 28441 +#define IDH_GENERIC_HELP_BUTTON 28442 +#define IDH_OK 28443 +#define IDH_CANCEL 28444 +#define IDH_HELP 28445 +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define IDTIMEOUT 32000 +#define OCR_NORMAL 32512 +#define OIC_SAMPLE 32512 +#define IDI_APPLICATION 32512 +#define OCR_IBEAM 32513 +#define OIC_HAND 32513 +#define IDI_HAND 32513 +#define OCR_WAIT 32514 +#define OIC_QUES 32514 +#define IDI_QUESTION 32514 +#define OCR_CROSS 32515 +#define OIC_BANG 32515 +#define IDI_EXCLAMATION 32515 +#define OCR_UP 32516 +#define OIC_NOTE 32516 +#define IDI_ASTERISK 32516 +#define OIC_WINLOGO 32517 +#define IDI_WINLOGO 32517 +#define OIC_SHIELD 32518 +#define IDI_SHIELD 32518 +#define OCR_SIZE 32640 +#define OCR_ICON 32641 +#define OCR_SIZENWSE 32642 +#define OCR_SIZENESW 32643 +#define OCR_SIZEWE 32644 +#define OCR_SIZENS 32645 +#define OCR_SIZEALL 32646 +#define OCR_ICOCUR 32647 +#define OCR_NO 32648 +#define OCR_HAND 32649 +#define OCR_APPSTARTING 32650 +#define OBM_LFARROWI 32734 +#define OBM_RGARROWI 32735 +#define OBM_DNARROWI 32736 +#define OBM_UPARROWI 32737 +#define OBM_COMBO 32738 +#define OBM_MNARROW 32739 +#define OBM_LFARROWD 32740 +#define OBM_RGARROWD 32741 +#define OBM_DNARROWD 32742 +#define OBM_UPARROWD 32743 +#define OBM_RESTORED 32744 +#define OBM_ZOOMD 32745 +#define OBM_REDUCED 32746 +#define OBM_RESTORE 32747 +#define OBM_ZOOM 32748 +#define OBM_REDUCE 32749 +#define OBM_LFARROW 32750 +#define OBM_RGARROW 32751 +#define OBM_DNARROW 32752 +#define OBM_UPARROW 32753 +#define OBM_CLOSE 32754 +#define OBM_OLD_RESTORE 32755 +#define OBM_OLD_ZOOM 32756 +#define OBM_OLD_REDUCE 32757 +#define OBM_BTNCORNERS 32758 +#define OBM_CHECKBOXES 32759 +#define OBM_CHECK 32760 +#define OBM_BTSIZE 32761 +#define OBM_OLD_LFARROW 32762 +#define OBM_OLD_RGARROW 32763 +#define OBM_OLD_DNARROW 32764 +#define OBM_OLD_UPARROW 32765 +#define OBM_SIZE 32766 +#define OBM_OLD_CLOSE 32767 +#define WM_APP 0x8000 +#define HELP_TCARD 0x8000 +#define TBSTYLE_TRANSPARENT 0x8000 +#define RBS_DBLCLKTOGGLE 0x00008000 +#define LVS_NOSORTHEADER 0x8000 +#define TVS_NOHSCROLL 0x8000 +#define TCS_FOCUSNEVER 0x8000 +#define SC_SIZE 0xF000 +#define SC_SEPARATOR 0xF00F +#define SC_MOVE 0xF010 +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#define SC_NEXTWINDOW 0xF040 +#define SC_PREVWINDOW 0xF050 +#define SC_CLOSE 0xF060 +#define SC_VSCROLL 0xF070 +#define SC_HSCROLL 0xF080 +#define SC_MOUSEMENU 0xF090 +#define SC_KEYMENU 0xF100 +#define SC_ARRANGE 0xF110 +#define SC_RESTORE 0xF120 +#define SC_TASKLIST 0xF130 +#define SC_SCREENSAVE 0xF140 +#define SC_HOTKEY 0xF150 +#define SC_DEFAULT 0xF160 +#define SC_MONITORPOWER 0xF170 +#define SC_CONTEXTHELP 0xF180 +#define LVS_TYPESTYLEMASK 0xfc00 +#define SPVERSION_MASK 0x0000FF00 #define IDC_STATIC -1 +#define UNICODE_NOCHAR 0xFFFF // Next default values for new objects // diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index d5b6f8bf25..a9079746fb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -192,10 +192,10 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight #elif defined(_WIN32) // Create rendering window in Windows // Create a separate window - /*if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL) + if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL) g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait...")); // Create a child window - else*/ + else g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Please wait...")); // Show the window diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp index bad3d157f8..042342777c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp @@ -146,8 +146,7 @@ namespace EmuWindow { HWND m_hWnd = NULL; // The new window that is created here -HWND m_hParent = NULL; -HWND m_hMain = NULL; // The main CPanel +HWND m_hParent = NULL; // The main CPanel HINSTANCE m_hInstance = NULL; WNDCLASSEX wndClass; @@ -244,10 +243,16 @@ void OnKeyDown(WPARAM wParam) switch (LOWORD( wParam )) { case VK_ESCAPE: - if (!g_Config.RenderToMainframe) + if (g_Config.bFullscreen && !g_Config.RenderToMainframe) { - // Pressing Esc stops the emulation - SendMessage( m_hWnd, WM_CLOSE, 0, 0 ); + // Pressing Esc switch to Windowed in Fullscreen mode + ToggleFullscreen(m_hWnd); + return; + } + else if (!g_Config.RenderToMainframe) + { + // And stops the emulation when already in Windowed mode + PostMessage(m_hParent, WM_USER, OPENGL_WM_USER_STOP, 0); } break; case '3': // OSD keys @@ -270,7 +275,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) switch (iMsg) { case WM_CREATE: - PostMessage(m_hMain, WM_USER, WM_USER_CREATE, g_Config.RenderToMainframe); + PostMessage((HWND)g_VideoInitialize.pWindowHandle, WM_USER, OPENGL_WM_USER_CREATE, (int)m_hParent); break; case WM_PAINT: @@ -320,7 +325,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) it's nessesary for both the child window and separate rendering window because moves over the rendering window do not reach the main program then. */ if (GetParentWnd() == NULL) { // Separate rendering window - PostMessage(m_hMain, iMsg, wParam, -1); + PostMessage(m_hParent, iMsg, wParam, -1); SetCursor(hCursor); } else @@ -331,14 +336,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) only let it pass through Dolphin > Frame.cpp to determine if it should be on or off and coordinate it with the other settings if nessesary */ case WM_USER: - if (wParam == WM_USER_STOP) + if (wParam == OPENGL_WM_USER_STOP) { if (lParam) SetCursor(hCursor); else SetCursor(hCursorBlank); } - if (wParam == WM_USER_KEYDOWN) + if (wParam == OPENGL_WM_USER_KEYDOWN) OnKeyDown(lParam); if (wParam == TOGGLE_FULLSCREEN) ToggleFullscreen(m_hWnd); @@ -349,7 +354,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) if (m_hParent == NULL) { // Simple hack to easily exit without stopping. Hope to fix the stopping errors soon. - PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0); + ExitProcess(0); return 0; } @@ -400,16 +405,16 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T CreateCursors(m_hInstance); // Create child window - if (g_Config.RenderToMainframe) + if (parent) { - m_hParent = m_hMain = parent; + m_hParent = parent; - m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD, + m_hWnd = CreateWindow(m_szClassName, title, + WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, hInstance, NULL); - if( !g_Config.bFullscreen ) - SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER ); + ShowWindow(m_hWnd, SW_SHOWMAXIMIZED); } // Create new separate window @@ -419,7 +424,6 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T // render to main, stop, then render to separate window, as the GUI will still // think we're rendering to main because m_hParent will still contain the old HWND... m_hParent = NULL; - m_hMain = parent; DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW; @@ -434,9 +438,13 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T rc.top = (1024 - h)/2; rc.bottom = rc.top + h; - m_hWnd = CreateWindowEx(0, m_szClassName, title, style, + m_hWnd = CreateWindow(m_szClassName, title, + style, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, - NULL, NULL, hInstance, NULL); + parent, NULL, hInstance, NULL ); + + g_winstyle = GetWindowLong( m_hWnd, GWL_STYLE ); + g_winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style } return m_hWnd; @@ -531,9 +539,7 @@ void Show() HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title) { - int width=640, height=480; - sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height ); - return OpenWindow(hParent, hInstance, width, height, title); + return OpenWindow(hParent, hInstance, 640, 480, title); } void Close() @@ -548,8 +554,7 @@ void Close() void SetSize(int width, int height) { RECT rc = {0, 0, width, height}; - DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE); - AdjustWindowRect(&rc, dwStyle, false); + AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false); int w = rc.right - rc.left; int h = rc.bottom - rc.top; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp index f92d2cc3e1..6f80adb1ae 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp @@ -129,7 +129,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) switch( iMsg ) { case WM_CREATE: - PostMessage(m_hMain, WM_USER, WM_USER_CREATE, (int)m_hParent); + PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_CREATE, (int)m_hParent); break; case WM_PAINT: @@ -164,7 +164,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) else if (!g_Config.renderToMainframe) { // And stops the emulation when already in Windowed mode - PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0); + PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0); } break; } diff --git a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj index 0f0563fb38..983bbfd74f 100644 --- a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj +++ b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj @@ -67,10 +67,10 @@ /> = WiiMoteEmu::joyinfo.size()) continue; // Create a section name - std::string JoySectionName = WiiMoteEmu::PadMapping[i].Name; - // Don't load settings for a non-connected device - if (!WiiMoteEmu::IsConnected(JoySectionName)) - { - ERROR_LOG(PAD, "Slot %i: The device '%s' is not connected, will not load settings", i, JoySectionName.c_str()); - continue; - } - // Don't load a blank ID - if (JoySectionName == "") - { - ERROR_LOG(PAD, "Slot %i has no device name, will not load settings", i); - continue; - } + std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; - iniFile.Get(JoySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0); - iniFile.Get(JoySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1); - iniFile.Get(JoySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2); - iniFile.Get(JoySectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3); - iniFile.Get(JoySectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 1004); - iniFile.Get(JoySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005); - iniFile.Get(JoySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0); - iniFile.Get(JoySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0); - iniFile.Get(JoySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); - iniFile.Get(JoySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); - iniFile.Get(JoySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); - iniFile.Get(JoySectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); - iniFile.Get(JoySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); - - NOTICE_LOG(WIIMOTE, "Slot %i: Load settings for ID %i '%s'", i, WiiMoteEmu::PadMapping[i].ID, JoySectionName.c_str()); + iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0); + iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1); + iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2); + iniFile.Get(joySectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3); + iniFile.Get(joySectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 1004); + iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005); + iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0); + iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0); + iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); + iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); + iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); + iniFile.Get(joySectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); + iniFile.Get(joySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); } // Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini"); @@ -391,7 +375,6 @@ void Config::Save(int Slot) iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled); iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); iniFile.Set(SectionName, "TriggerType", Trigger.Type); - iniFile.Set(SectionName, "TriggerUpright", Trigger.Upright); iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll); iniFile.Set(SectionName, "TriggerPitchRange", Trigger.Range.Pitch); @@ -417,23 +400,18 @@ void Config::Save(int Slot) // Save the physical device ID number iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::PadMapping[i].ID); - iniFile.Set(SectionName, "DeviceName", WiiMoteEmu::PadMapping[i].Name); // Joypad specific settings - // Current joypad device ID: PadMapping[i].ID - // Current joypad name: IDToName(PadMapping[i].ID]) + // Current joypad device ID: PadMapping[i].ID + // Current joypad name: joyinfo[PadMapping[i].ID].Name + + // Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to + // avoid reading a joyinfo that does't exist + if((u32)WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue; // Create a new section name after the joypad name - std::string joySectionName = WiiMoteEmu::IDToName(WiiMoteEmu::PadMapping[i].ID); - // Don't save a blank name - if (SectionName == "") - { - ERROR_LOG(WIIMOTE, "ID %i has no name, will not load", WiiMoteEmu::PadMapping[i].ID); - continue; - } - - NOTICE_LOG(WIIMOTE, "Save settings for ID %i '%s' from PadMapping[%i]", WiiMoteEmu::PadMapping[i].ID, joySectionName.c_str(), i); - + std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; + iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx); iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly); iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx); diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index c2b0a93667..c392e6b308 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -41,7 +41,6 @@ struct Config Config(); void Load(bool ChangePad = false); void Save(int Slot = -1); - bool Loaded; struct PadRange { @@ -60,7 +59,6 @@ struct Config TRIGGER }; int Type; - bool Upright; PadRange Range; }; struct PadNunchuck diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp index b23b91e211..e3ced1e631 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp @@ -34,7 +34,6 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog) EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) // IR cursor @@ -208,9 +207,9 @@ void WiimoteBasicConfigDialog::CreateGUIControls() // Emulated Wiimote m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad")); m_SidewaysDPad[i]->SetValue(g_Config.bSidewaysDPad); - m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote")); - m_UprightWiimote[i]->SetValue(g_Config.Trigger.Upright); - m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral for roll and pitch")); + + m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote")); + m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5); //IR Pointer m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000")); @@ -252,12 +251,6 @@ void WiimoteBasicConfigDialog::CreateGUIControls() m_CheckAR169[i]->Enable(false); m_Crop[i]->Enable(false); - // Sizers - - m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote")); - m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5); - m_SizeEmu[i]->Add(m_UprightWiimote[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5); - m_SizerIRPointerScreen[i] = new wxBoxSizer(wxHORIZONTAL); m_SizerIRPointerScreen[i]->Add(m_TextAR[i], 0, wxEXPAND | (wxTOP), 0); m_SizerIRPointerScreen[i]->Add(m_CheckAR43[i], 0, wxEXPAND | (wxLEFT), 5); @@ -398,9 +391,6 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) case ID_SIDEWAYSDPAD: g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked(); - break; - case ID_UPRIGHTWIIMOTE: - g_Config.Trigger.Upright = m_UprightWiimote[Page]->IsChecked(); break; case ID_MOTIONPLUSCONNECTED: diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h index 794f2f28c4..4a4f48aaab 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h @@ -79,7 +79,6 @@ class WiimoteBasicConfigDialog : public wxDialog // Emulated Wiimote settings wxCheckBox *m_SidewaysDPad[4], - *m_UprightWiimote[4], *m_WiimoteOnline[4], *m_WiiMotionPlusConnected[4], *m_CheckAR43[4], @@ -127,7 +126,6 @@ class WiimoteBasicConfigDialog : public wxDialog // Emulated Wiimote ID_SIDEWAYSDPAD, - ID_UPRIGHTWIIMOTE, ID_MOTIONPLUSCONNECTED, ID_EXTCONNECTED, IDC_WIMOTE_ON, diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 4b13013bde..5fbd1802f4 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -30,15 +30,36 @@ is only used the first time the pads are checked. */ void WiimotePadConfigDialog::DoChangeJoystick() { - WARN_LOG(WIIMOTE, "---- DoChangeJoystick ----"); + // Close the current pad, unless it's used by another slot + //if (PadMapping[notebookpage].enabled) PadClose(notebookpage); // Before changing the pad we save potential changes to the current pad DoSave(true); // Load the settings for the new Id g_Config.Load(true); - // Update the GUI - UpdateGUI(Page); + UpdateGUI(Page); // Update the GUI + + // Open the new pad + if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page); +} +void WiimotePadConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4 +{ + // Check that we got a good pad + if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good) + { + DEBUG_LOG(WIIMOTE, "A bad pad was selected"); + WiiMoteEmu::PadState[Open].joy = NULL; + return; + } + + DEBUG_LOG(WIIMOTE, "Update the Slot %i handle to Id %i", Page, WiiMoteEmu::PadMapping[Open].ID); + WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID); +} +void WiimotePadConfigDialog::PadClose(int _Close) // Close for slot 1, 2, 3 or 4 +{ + if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[_Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[_Close].joy); + WiiMoteEmu::PadState[_Close].joy = NULL; } void WiimotePadConfigDialog::DoChangeDeadZone(bool Left) @@ -69,29 +90,30 @@ void WiimotePadConfigDialog::DoChangeDeadZone(bool Left) // Set the button text for all four Wiimotes void WiimotePadConfigDialog::SetButtonTextAll(int id, char text[128]) { - for (int i = 0; i < MAX_WIIMOTES; i++) + for (int i = 0; i < 1; i++) { - if (WiiMoteEmu::IDToName(WiiMoteEmu::PadMapping[i].ID) == WiiMoteEmu::IDToName(WiiMoteEmu::PadMapping[Page].ID)) - { - SetButtonText(id, text, i); - DEBUG_LOG(PAD, "Updated button text for slot %i", i); - } + // Safety check to avoid crash + if ((int)WiiMoteEmu::joyinfo.size() > WiiMoteEmu::PadMapping[i].ID) + if (WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name == WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[Page].ID].Name) + SetButtonText(id, text, i); }; } + + void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot) { - for (int i = 0; i < MAX_WIIMOTES; i++) + for (int i = 0; i < 4; i++) { - if (WiiMoteEmu::PadMapping[i].Name.length() > 0 && WiiMoteEmu::PadMapping[i].Name == WiiMoteEmu::PadMapping[Slot].Name) - SaveButtonMapping(i, false, Slot); + // This can occur when no gamepad is detected + if ((int)WiiMoteEmu::joyinfo.size() > WiiMoteEmu::PadMapping[i].ID && WiiMoteEmu::PadMapping[i].ID >= 0) + if (WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name == WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[Slot].ID].Name) + SaveButtonMapping(i, false, Slot); } } // Set dialog items from saved values void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) { - NOTICE_LOG(WIIMOTE, "Load ButtonMapping | controller:%i", controller); - // Temporary storage wxString tmp; @@ -182,19 +204,12 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) { - // Log - NOTICE_LOG(WIIMOTE, "SaveButtonMapping | controller:%i FromSlot:%i", controller, FromSlot); - // Temporary storage wxString tmp; long value; // Save from or to the same or different slots if (FromSlot == -1) FromSlot = controller; - - // TEMPORARY - // There is only one slot at the moment - if (FromSlot > MAX_WIIMOTES-1) FromSlot = MAX_WIIMOTES-1; // Replace "" with "-1" in the GUI controls ToBlank(false); @@ -203,11 +218,7 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId -1 that's a bug that should be fixed. Because the m_Joyname[] combo box should always show , or a gamepad name, not a a blank selection. */ if (!DontChangeId) - { - if (m_Joyname[FromSlot]->GetSelection() >= WiiMoteEmu::joyinfo.size()) PanicAlert("Bug in SaveButtonMapping"); - WiiMoteEmu::PadMapping[controller].ID = WiiMoteEmu::joyinfo.at(m_Joyname[FromSlot]->GetSelection()).ID; - WiiMoteEmu::PadMapping[controller].Name = m_Joyname[FromSlot]->GetValue().mb_str(); - } + WiiMoteEmu::PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection(); // Set enabled or disable status if (FromSlot == controller) WiiMoteEmu::PadMapping[controller].enabled = true; //m_Joyattach[FromSlot]->GetValue(); // Only enable one @@ -361,11 +372,6 @@ void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event) void WiimotePadConfigDialog::DoGetButtons(int _GetId) { - DEBUG_LOG(WIIMOTE, "DoGetButtons"); - - bool _LiveUpdates = LiveUpdates; - LiveUpdates = false; - // Collect the starting values // Get the current controller @@ -393,7 +399,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) // Values used in this function char format[128]; int Seconds = 4; // Seconds to wait for - int TimesPerSecond = 60; // How often to run the check + int TimesPerSecond = 40; // How often to run the check // Values returned from InputCommon::GetButton() int value; // Axis value @@ -432,7 +438,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) ); #endif DEBUG_LOG(WIIMOTE, "Timer Started for Pad:%i _GetId:%i" - " Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n", + "Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n", WiiMoteEmu::PadMapping[Controller].ID, _GetId, Axis, LeftRight, XInput, Button, Hat); } @@ -443,7 +449,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) else { InputCommon::GetButton( - WiiMoteEmu::PadState[Page].joy, PadID, + WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, g_Pressed, value, type, pressed, Succeed, Stop, LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); } @@ -476,7 +482,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) } // If we got a button - if (Succeed) + if(Succeed) { Stop = true; // Write the number of the pressed button to the text box @@ -485,11 +491,10 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) } // Stop the timer - if (Stop) + if(Stop) { m_ButtonMappingTimer->Stop(); GetButtonWaitingTimer = 0; - LiveUpdates = _LiveUpdates; /* Update the button mapping for all slots that use this device. (It doesn't make sense to have several slots controlled by the same @@ -540,12 +545,12 @@ void WiimotePadConfigDialog::Convert2Box(int &x) // Update the input status boxes void WiimotePadConfigDialog::PadGetStatus() { - //DEBUG_LOG(WIIMOTE, "PadGetStatus"); + //DEBUG_LOG(WIIMOTE, "SDL_WasInit: %i", SDL_WasInit(0)); /* Return if it's not detected. The ID should never be less than zero here, it can only be that because of a manual ini file change, but we make that check anway. */ - if (WiiMoteEmu::PadMapping[Page].ID < 0 || WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks()) + if(WiiMoteEmu::PadMapping[Page].ID < 0 || WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks()) { m_TStatusLeftIn[Page]->SetLabel(wxT("Not connected")); m_TStatusLeftOut[Page]->SetLabel(wxT("Not connected")); @@ -569,13 +574,15 @@ void WiimotePadConfigDialog::PadGetStatus() } // Get physical device status - int ID = WiiMoteEmu::PadMapping[Page].ID; + int PhysicalDevice = WiiMoteEmu::PadMapping[Page].ID; int TriggerType = WiiMoteEmu::PadMapping[Page].triggertype; // Check that Dolphin is in focus, otherwise don't update the pad status //if (IsFocus()) - WiiMoteEmu::GetJoyState(WiiMoteEmu::PadState[Page], WiiMoteEmu::PadMapping[Page], Page); + WiiMoteEmu::GetJoyState(WiiMoteEmu::PadState[Page], WiiMoteEmu::PadMapping[Page], Page, WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Page].ID).NumButtons); + + // Analog stick // Set Deadzones perhaps out of function //int deadzone = (int)(((float)(128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1)); @@ -688,45 +695,16 @@ void WiimotePadConfigDialog::PadGetStatus() wxT("%03i"), TriggerRight)); } -// Slow timer, once a second -void WiimotePadConfigDialog::Update(wxTimerEvent& WXUNUSED(event)) -{ - if (!LiveUpdates) return; - - // Don't run this the first time - int OldNumDIDevices; - if (WiiMoteEmu::NumDIDevices == -1) - OldNumDIDevices = InputCommon::SearchDIDevices(); - else - // Search for connected devices and update dialog - OldNumDIDevices = WiiMoteEmu::NumDIDevices; - WiiMoteEmu::NumDIDevices = InputCommon::SearchDIDevices(); - - // Update if a pad has been connected/disconnected. Todo: Add a better check that also takes into consideration the pad id - // and other things to ensure nothing has changed - //DEBUG_LOG(WIIMOTE, "Found %i devices", WiiMoteEmu::NumDIDevices); - //DEBUG_LOG(WIIMOTE, "Update: %i %i", OldNumPads, WiiMoteEmu::NumPads); - if (OldNumDIDevices != WiiMoteEmu::NumDIDevices) - { - WiiMoteEmu::LocalSearchDevicesReset(WiiMoteEmu::joyinfo, WiiMoteEmu::NumPads); - WiimotePadConfigDialog::UpdateDeviceList(); - } -} - // Populate the advanced tab void WiimotePadConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event)) { - if (!WiiMoteEmu::IsPolling()) return; - - //DEBUG_LOG(WIIMOTE, "UpdatePad"); - // Show the current status + /* #ifdef SHOW_PAD_STATUS - m_pStatusBar->SetLabel(wxString::FromAscii(InputCommon::DoShowStatus( - Page, m_Joyname[Page]->GetSelection(), - WiiMoteEmu::PadMapping, WiiMoteEmu::PadState, WiiMoteEmu::joyinfo - ).c_str())); - #endif + m_pStatusBar->SetLabel(wxString::Format( + "%s", ShowStatus(notebookpage).c_str() + )); + #endif*/ //LogMsg("Abc%s\n", ShowStatus(notebookpage).c_str()); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index a0fe473d54..a9df2b6efe 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -98,7 +98,6 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog) EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::GetButtons) EVT_TIMER(IDTM_BUTTON, WiimotePadConfigDialog::OnButtonTimer) - EVT_TIMER(IDTM_UPDATE, WiimotePadConfigDialog::Update) EVT_TIMER(IDTM_UPDATE_PAD, WiimotePadConfigDialog::UpdatePad) END_EVENT_TABLE() @@ -108,18 +107,14 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, { #if wxUSE_TIMER m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON); - m_Update = new wxTimer(this, IDTM_UPDATE); - m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD); + m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD); // Reset values GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; - // Start the slow timer - int TimesPerSecond = 2; - m_Update->Start( floor((double)(1000 / TimesPerSecond)) ); - // Start the fast timer - TimesPerSecond = 30; + // Start the permanent timer + const int TimesPerSecond = 30; m_UpdatePad->Start( floor((double)(1000 / TimesPerSecond)) ); #endif @@ -133,9 +128,6 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, // Set control values UpdateGUI(); - - // Update device list - UpdateDeviceList(); wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard wxKeyEventHandler(WiimotePadConfigDialog::OnKeyDown), @@ -212,13 +204,9 @@ void WiimotePadConfigDialog::OnClose(wxCloseEvent& event) { g_FrameOpen = false; SaveButtonMappingAll(Page); - // Stop timers - if(m_Update) m_Update->Stop(); - if(m_UpdatePad) m_UpdatePad->Stop(); - if(m_ButtonMappingTimer) m_ButtonMappingTimer->Stop(); - INFO_LOG(WIIMOTE, "All timers stopped"); + if(m_UpdatePad) + m_UpdatePad->Stop(); g_Config.Save(); - event.Skip(); } @@ -240,20 +228,18 @@ void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event) void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot) { - WARN_LOG(WIIMOTE, "DoSave - %i slot %i", ChangePad, Slot); - // Replace "" with "-1" before we are saving ToBlank(false); if(ChangePad) { // Since we are selecting the pad to save to by the Id we can't update it when we change the pad - for(int i = 0; i < MAX_WIIMOTES; i++) + for(int i = 0; i < 4; i++) SaveButtonMapping(i, true); // Save the settings for the current pad g_Config.Save(Slot); // Now we can update the ID - UpdateID(); + WiiMoteEmu::PadMapping[Page].ID = m_Joyname[Page]->GetSelection(); } else { @@ -265,14 +251,8 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot) // Then change it back to "" ToBlank(); -} -void WiimotePadConfigDialog::UpdateID() -{ - INFO_LOG(WIIMOTE, "PadMapping[%i].ID = %i from %i", - Page, WiiMoteEmu::joyinfo.at(m_Joyname[Page]->GetSelection()).ID, WiiMoteEmu::PadMapping[Page].ID); - WiiMoteEmu::PadMapping[Page].ID = WiiMoteEmu::joyinfo.at(m_Joyname[Page]->GetSelection()).ID; - WiiMoteEmu::PadMapping[Page].Name = m_Joyname[Page]->GetValue().mb_str(); - WiiMoteEmu::PadState[Page].joy = WiiMoteEmu::joyinfo.at(m_Joyname[Page]->GetSelection()).joy; + + DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i", Page, m_Joyname[Page]->GetSelection()); } // Bitmap box and dot @@ -345,40 +325,24 @@ wxBitmap WiimotePadConfigDialog::CreateBitmapClear() return bitmap; } -void WiimotePadConfigDialog::UpdateDeviceList() -{ - if (!ControlsCreated) return; - DEBUG_LOG(WIIMOTE, "UpdateDeviceList"); - - for (int i = 0; i < MAX_WIIMOTES; i++) - { - // Save current selection - //std::string CurrentSel = m_Joyname[i]->GetValue().mb_str(); - m_Joyname[i]->Clear(); - - // Search for devices and add them to the device list - if (WiiMoteEmu::joyinfo.size() > 0) - { - for (int j = 0; j < WiiMoteEmu::joyinfo.size(); j++) - m_Joyname[i]->Append(wxString::FromAscii(WiiMoteEmu::joyinfo.at(j).Name.c_str())); - // Set selection - for (int j = 0; j < WiiMoteEmu::joyinfo.size(); j++) - if (WiiMoteEmu::joyinfo.at(j).Name == WiiMoteEmu::PadMapping[i].Name) m_Joyname[i]->SetSelection(j); - if (m_Joyname[i]->GetSelection() == -1) m_Joyname[i]->SetSelection(0); - // Load settings - DoChangeJoystick(); - } - else - { - m_Joyname[i]->Append(wxString::FromAscii("")); - m_Joyname[i]->SetSelection(0); - } - } -} void WiimotePadConfigDialog::CreatePadGUIControls() { + + + // Search for devices and add them to the device list + wxArrayString StrJoyname; // The string array + if (WiiMoteEmu::NumGoodPads > 0) + { + for (int x = 0; x < (int)WiiMoteEmu::joyinfo.size(); x++) + StrJoyname.Add(wxString::FromAscii(WiiMoteEmu::joyinfo[x].Name.c_str())); + } + else + { + StrJoyname.Add(wxString::FromAscii("")); + } + // The tilt list wxArrayString StrTilt; StrTilt.Add(wxString::FromAscii("")); @@ -408,17 +372,13 @@ void WiimotePadConfigDialog::CreatePadGUIControls() wxArrayString StrCcTriggers; StrCcTriggers.Add(wxString::FromAscii("Keyboard")); StrCcTriggers.Add(wxString::FromAscii("Triggers")); - - #ifdef SHOW_PAD_STATUS - m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxSize(-1, 600)); - m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(250, 250), wxDefaultSize); - #else + + m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - #endif for (int i = 0; i < MAX_WIIMOTES; i++) - { - m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize); + { + m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1)); // A small type font @@ -427,8 +387,9 @@ void WiimotePadConfigDialog::CreatePadGUIControls() // Configuration controls sizes static const int TxtW = 50, TxtH = 19, BtW = 75, BtH = 20; + // Controller - m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, wxEmptyString, wxDefaultPosition, wxSize(200, -1), 0, NULL, wxCB_READONLY); + m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(200, -1), StrJoyname, wxCB_READONLY); // Circle to square m_CheckC2S[i] = new wxCheckBox(m_Controller[i], IDC_LEFT_C2S, wxT("Circle To Square")); @@ -985,6 +946,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls() } + m_Apply = new wxButton(this, ID_APPLY, wxT("Apply")); m_Close = new wxButton(this, ID_CLOSE, wxT("Close")); m_Close->SetToolTip(wxT("Apply and Close")); @@ -1075,16 +1037,14 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) void WiimotePadConfigDialog::UpdateGUI(int Slot) { - DEBUG_LOG(WIIMOTE, "UpdateGUI"); - UpdateGUIButtonMapping(Page); DoChangeDeadZone(true); DoChangeDeadZone(false); // Linux has no FindItem() // Disable all pad items if no pads are detected - if (ControlsCreated) + if(ControlsCreated) { - bool PadEnabled = WiiMoteEmu::NumPads != 0; + bool PadEnabled = WiiMoteEmu::NumGoodPads != 0; #ifdef _WIN32 for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++) m_Notebook->FindItem(i)->Enable(PadEnabled); m_Notebook->FindItem(IDC_JOYNAME)->Enable(PadEnabled); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h index 9ca709eee0..ad200aa3cb 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h @@ -59,12 +59,9 @@ class WiimotePadConfigDialog : public wxDialog void Convert2Box(int &x); void ConvertToString(); void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); } - void Update(wxTimerEvent& WXUNUSED(event)); void UpdatePad(wxTimerEvent& WXUNUSED(event)); - void UpdateDeviceList(); - wxTimer *m_Update, - *m_UpdatePad, + wxTimer *m_UpdatePad, *m_ButtonMappingTimer; wxStaticBitmap *m_bmpDotLeftIn[4], @@ -77,7 +74,6 @@ class WiimotePadConfigDialog : public wxDialog DECLARE_EVENT_TABLE(); bool ControlsCreated; - bool LiveUpdates; int Page, BoxW, BoxH, g_Pressed; wxNotebook *m_Notebook; @@ -146,9 +142,7 @@ class WiimotePadConfigDialog : public wxDialog *m_Button_GH3[GH3_CONTROLS][4], *m_bGH3_Analog[4]; - wxStaticText - *m_pStatusBar, - *m_TextScreenWidth[4], *m_TextScreenHeight[4], *m_TextScreenLeft[4], *m_TextScreenTop[4], *m_TextAR[4], + wxStaticText *m_TextScreenWidth[4], *m_TextScreenHeight[4], *m_TextScreenLeft[4], *m_TextScreenTop[4], *m_TextAR[4], *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4], *m_CheckC2SLabel[4], *m_ComboDeadZoneLabel[4], *m_TStatusLeftIn[4], *m_TStatusLeftOut[4], *m_TStatusRightIn[4], *m_TStatusRightOut[4], *m_TriggerStatusL[4], *m_TriggerStatusR[4], *m_TriggerStatusLx[4], *m_TriggerStatusRx[4], @@ -184,12 +178,10 @@ class WiimotePadConfigDialog : public wxDialog { ID_CLOSE = 1000, ID_APPLY, - IDTM_EXIT, // Timer + IDTM_EXIT, IDTM_BUTTON, - IDTM_UPDATE, - IDTM_UPDATE_PAD, - - IDT_DEBUGGING, + IDTM_UPDATE_PAD, // Timer + ID_NOTEBOOK, ID_CONTROLLERPAGE1, ID_CONTROLLERPAGE2, @@ -265,9 +257,8 @@ class WiimotePadConfigDialog : public wxDialog void SaveKeyboardMapping(int Controller, int Id, int Key); void ToBlank(bool ToBlank = true); void PadGetStatus(); - void UpdateID(); void DoSave(bool ChangePad = false, int Slot = -1); - void DoChangeJoystick(); void DoChangeDeadZone(bool Left); + void DoChangeJoystick(); void PadOpen(int Open); void PadClose(int Close); void DoChangeDeadZone(bool Left); void OnButtonClick(wxCommandEvent& event); // Configure buttons diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp index 2823eb568f..fd3af76015 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp @@ -57,14 +57,7 @@ wiimote_key g_ExtKey; // The extension encryption key bool g_Encryption; // Encryption on or off // Gamepad input -int NumPads = 0, NumDIDevices = -1; // Number of pads -bool SDLPolling = true; -#ifdef _WIN32 -bool LiveUpdates = false; -#else -bool LiveUpdates = false; -#endif - +int NumPads = 0, NumGoodPads = 0; // Number of goods pads std::vector joyinfo; InputCommon::CONTROLLER_STATE_NEW PadState[4]; InputCommon::CONTROLLER_MAPPING_NEW PadMapping[4]; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index e54614bbb1..84ea66ca71 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -182,9 +182,7 @@ static const u8 partially_id[] = }; // Gamepad input -extern int NumPads, NumDIDevices; // Number of pads -extern bool SDLPolling; // Turn off polling -extern bool LiveUpdates; +extern int NumPads, NumGoodPads; // Number of goods pads extern std::vector joyinfo; extern InputCommon::CONTROLLER_STATE_NEW PadState[4]; extern InputCommon::CONTROLLER_MAPPING_NEW PadMapping[4]; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp index 4383ceee07..b2f8c11703 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp @@ -22,7 +22,6 @@ #include "../../../Core/InputCommon/Src/XInput.h" #include "Common.h" // Common -#include "LogManager.h" #include "MathUtil.h" #include "StringUtil.h" // for ArrayToString() #include "IniFile.h" @@ -60,8 +59,7 @@ void TiltTest(u8 x, u8 y, u8 z) std::string To = StringFromFormat("%s\nTo: X:%i Y:%i Z:%i Roll:%s Pitch:%s", From.c_str(), x, y, z, (_Roll >= 0) ? StringFromFormat(" %03i", (int)_Roll).c_str() : StringFromFormat("%04i", (int)_Roll).c_str(), (_Pitch >= 0) ? StringFromFormat(" %03i", (int)_Pitch).c_str() : StringFromFormat("%04i", (int)_Pitch).c_str()); - ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->CustomLog(StringFromFormat("\n%s", To.c_str()).c_str()); + DEBUG_LOG(WIIMOTE, "%s", To.c_str()); } @@ -102,29 +100,14 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_ // In these cases we can use the simple and accurate formula if(g_Config.Trigger.Range.Pitch == 0) { - if (!g_Config.Trigger.Upright) - { - x = sin(_Roll); - z = cos(_Roll); - } - else - { - z = sin(_Roll); - y = -cos(_Roll); - } + x = sin(_Roll); + z = cos(_Roll); } else if (g_Config.Trigger.Range.Roll == 0) { - if (!g_Config.Trigger.Upright) - { - y = sin(_Pitch); - z = cos(_Pitch); - } - else - { - x = -sin(_Pitch); - y = -cos(_Pitch); - } + + y = sin(_Pitch); + z = cos(_Pitch); } else { @@ -135,28 +118,16 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_ and Pitch. But if we select a Z from the smallest of the absolute value of cos(Roll) and cos (Pitch) we get the right values. */ // --------- - if (!g_Config.Trigger.Upright) - { - if (abs(cos(_Roll)) < abs(cos(_Pitch))) z = cos(_Roll); else z = cos(_Pitch); - /* I got these from reversing the calculation in - PitchAccelerometerToDegree() in a math program. */ - float x_num = 2 * tanf(0.5f * _Roll) * z; - float x_den = pow2f(tanf(0.5f * _Roll)) - 1; - x = - (x_num / x_den); - float y_num = 2 * tanf(0.5f * _Pitch) * z; - float y_den = pow2f(tanf(0.5f * _Pitch)) - 1; - y = - (y_num / y_den); - } - else - { - if (abs(-cos(_Roll)) < abs(-cos(_Pitch))) y = -cos(_Roll); else y = -cos(_Pitch); - float z_num = 2 * tanf(0.5f * _Roll) * y; - float z_den = pow2f(tanf(0.5f * _Roll)) - 1; - z = (z_num / z_den); - float x_num = 2 * tanf(0.5f * _Pitch) * y; - float x_den = pow2f(tanf(0.5f * _Pitch)) - 1; - x = - (x_num / x_den); - } + if (abs(cos(_Roll)) < abs(cos(_Pitch))) z = cos(_Roll); else z = cos(_Pitch); + /* I got these from reversing the calculation in + PitchAccelerometerToDegree() in a math program I don't know if we + can derive these from some kind of matrix or something */ + float x_num = 2 * tanf(0.5f * _Roll) * z; + float x_den = pow2f(tanf(0.5f * _Roll)) - 1; + x = - (x_num / x_den); + float y_num = 2 * tanf(0.5f * _Pitch) * z; + float y_den = pow2f(tanf(0.5f * _Pitch)) - 1; + y = - (y_num / y_den); } // Multiply with the neutral of z and its g @@ -174,18 +145,9 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_ if (ix < 0) ix = 0; if (ix > 255) ix = 255; if (iy < 0) iy = 0; if (iy > 255) iy = 255; if (iz < 0) iz = 0; if (iz > 255) iz = 255; - if (!g_Config.Trigger.Upright) - { - if(g_Config.Trigger.Range.Roll != 0) _x = ix; - if(g_Config.Trigger.Range.Pitch != 0) _y = iy; - _z = iz; - } - else - { - if(g_Config.Trigger.Range.Roll != 0) _z = iz; - if(g_Config.Trigger.Range.Pitch != 0) _x = ix; - _y = iy; - } + if(g_Config.Trigger.Range.Roll != 0) _x = ix; + if(g_Config.Trigger.Range.Pitch != 0) _y = iy; + _z = iz; } // Accelerometer to roll and pitch angles @@ -205,34 +167,17 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in float y = AccelerometerToG((float)_y, (float)g_wm.cal_zero.y, (float)g_wm.cal_g.y); float z = AccelerometerToG((float)_z, (float)g_wm.cal_zero.z, (float)g_wm.cal_g.z); - if (!g_Config.Trigger.Upright) + // If it is over 1g then it is probably accelerating and may not reliable + //if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) { - // If it is over 1g then it is probably accelerating and may not reliable - //if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) - { - // Calculate the degree - Roll = InputCommon::Rad2Deg(atan2(x, z)); - } - - //if (abs(_y - g_wm.cal_zero.y) <= g_wm.cal_g.y) - { - // Calculate the degree - Pitch = InputCommon::Rad2Deg(atan2(y, z)); - } + // Calculate the degree + Roll = InputCommon::Rad2Deg(atan2(x, z)); } - else - { - //if (abs(accel->z - ac->cal_zero.z) <= ac->cal_g.x) - { - // Calculate the degree - Roll = InputCommon::Rad2Deg(atan2(z, -y)); - } - //if (abs(_x - g_wm.cal_zero.x) <= g_wm.cal_g.x) - { - // Calculate the degree - Pitch = InputCommon::Rad2Deg(atan2(-x, -y)); - } + //if (abs(_y - g_wm.cal_zero.y) <= g_wm.cal_g.y) + { + // Calculate the degree + Pitch = InputCommon::Rad2Deg(atan2(y, z)); } _Roll = (int)Roll; @@ -242,16 +187,9 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in if (x < -1.0) x = -1.0; else if (x > 1.0) x = 1.0; if (y < -1.0) y = -1.0; else if (y > 1.0) y = 1.0; if (z < -1.0) z = -1.0; else if (z > 1.0) z = 1.0; - if (!g_Config.Trigger.Upright) - { - Roll = InputCommon::Rad2Deg(atan2(x, z)); - Pitch = InputCommon::Rad2Deg(atan2(y, z)); - } - else - { - Roll = InputCommon::Rad2Deg(atan2(z, -y)); - Pitch = InputCommon::Rad2Deg(atan2(-x, -y)); - } + Roll = InputCommon::Rad2Deg(atan2(x, z)); + Pitch = InputCommon::Rad2Deg(atan2(y, z)); + _RollAdj = (int)Roll; _PitchAdj = (int)Pitch; } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 88c16cf997..236b98cebd 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -34,11 +34,6 @@ #include "Encryption.h" // for extension encryption #include "Config.h" // for g_Config -#if defined(HAVE_WX) && HAVE_WX - #include "ConfigPadDlg.h" - extern WiimotePadConfigDialog *m_PadConfigFrame; -#endif - extern SWiimoteInitialize g_WiimoteInitialize; namespace WiiMoteEmu @@ -443,12 +438,10 @@ void Initialize() /* Populate joyinfo for all attached devices and do g_Config.Load() if the configuration window is not already open, if it's already open we continue with the settings we have */ - #if defined(HAVE_WX) && HAVE_WX - if (!m_PadConfigFrame) + if(!g_FrameOpen) { - LocalSearchDevices(joyinfo, NumPads); + Search_Devices(joyinfo, NumPads, NumGoodPads); } - #endif // Copy extension id and calibration to its register, g_Config.Load() is needed before this UpdateExtRegisterBlocks(); @@ -493,6 +486,7 @@ void DoState(PointerWrap &p) p.Do(g_Encryption); p.Do(NumPads); + p.Do(NumGoodPads); p.Do(joyinfo); p.DoArray(PadState, 4); p.DoArray(PadMapping, 4); @@ -515,16 +509,20 @@ void Shutdown(void) for (int i = 0; i < 1; i++) { if (PadMapping[i].enabled && joyinfo.size() > (u32)PadMapping[i].ID) - INFO_LOG(WIIMOTE, "ShutDown: %i", PadState[i].joy); - /* SDL_JoystickClose() crashes for some reason so I avoid this - for now, SDL_Quit() should close the pads to I think */ - //if(SDL_JoystickOpened(PadMapping[i].ID)) SDL_JoystickClose(PadState[i].joy); - //PadState[i].joy = NULL; + if (joyinfo.at(PadMapping[i].ID).Good) + { + INFO_LOG(WIIMOTE, "ShutDown: %i", PadState[i].joy); + /* SDL_JoystickClose() crashes for some reason so I avoid this + for now, SDL_Quit() should close the pads to I think */ + //if(SDL_JoystickOpened(PadMapping[i].ID)) SDL_JoystickClose(PadState[i].joy); + //PadState[i].joy = NULL; + } } // Clear the physical device info joyinfo.clear(); NumPads = 0; + NumGoodPads = 0; // Finally close SDL if (SDL_WasInit(0)) SDL_Quit(); @@ -695,8 +693,21 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) of times per second. */ void Update() { + readKeyboard(); + //LOG(WIIMOTE, "Wiimote_Update"); //INFO_LOG(WIIMOTE, "Emu Update: %i", g_ReportingMode); + // Check if the pad state should be updated + if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2 + || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2 + || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2 + || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2) + && NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[0].ID) + { + const int Page = 0; + WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page, joyinfo[PadMapping[Page].ID].NumButtons); + } + switch(g_ReportingMode) { case 0: @@ -710,22 +721,9 @@ void Update() // Potentially send a delayed acknowledgement to an InterruptChannel() Output CheckAckDelay(); - - ReadKeyboard(); - - // Check if the pad state should be updated - if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2 - || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2 - || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2 - || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2) - && NumPads > 0 && joyinfo.size() > (u32)PadMapping[0].ID) - { - const int Page = 0; - WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page); - } } -void ReadKeyboard() +void readKeyboard() { #if defined(HAVE_X11) && HAVE_X11 XEvent E; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h index f2664299ea..0878cd43db 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h @@ -41,7 +41,7 @@ void Shutdown(void); void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ; void Update(); -void ReadKeyboard(); +void readKeyboard(); // Recordings void LoadRecordedMovements(); @@ -52,14 +52,8 @@ void UpdateEeprom(); void UpdateExtRegisterBlocks(); // Gamepad -bool LocalSearchDevices(std::vector &_joyinfo, int &_NumPads); -bool LocalSearchDevicesReset(std::vector &_joyinfo, int &_NumPads); -bool DoLocalSearchDevices(std::vector &_joyinfo, int &_NumPads); -bool IsConnected(std::string Name); -bool IsPolling(); -void EnablePolling(bool Enable); -std::string IDToName(int ID); -void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller); +bool Search_Devices(std::vector &_joyinfo, int &_NumPads, int &_NumGoodPads); +void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons); void PadStateAdjustments(int &Lx, int &Ly, int &Rx, int &Ry, int &Tl, int &Tr); // Accelerometer diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp index 9b5e5c1256..f100b43f76 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp @@ -23,7 +23,6 @@ #include "../../../Core/InputCommon/Src/XInput.h" #include "Common.h" // Common -#include "LogManager.h" #include "StringUtil.h" // for ArrayToString() #include "IniFile.h" #include "pluginspecs_wiimote.h" @@ -36,125 +35,37 @@ #include "Encryption.h" // for extension encryption #include "Config.h" // for g_Config -#if defined(HAVE_WX) && HAVE_WX - #include "ConfigPadDlg.h" - extern WiimotePadConfigDialog *m_PadConfigFrame; -#endif - extern SWiimoteInitialize g_WiimoteInitialize; namespace WiiMoteEmu { - -bool LocalSearchDevices(std::vector &_joyinfo, int &_NumPads) -{ - //DEBUG_LOG(PAD, "LocalSearchDevices"); - bool bSuccess = InputCommon::SearchDevices(_joyinfo, _NumPads); - - DoLocalSearchDevices(_joyinfo, _NumPads); - - return bSuccess; -} - - -bool LocalSearchDevicesReset(std::vector &_joyinfo, int &_NumPads) -{ - DEBUG_LOG(CONSOLE, "LocalSearchDevicesReset"); - - // Turn off device polling while resetting - EnablePolling(false); - bool bSuccess = InputCommon::SearchDevicesReset(_joyinfo, _NumPads); - DoLocalSearchDevices(_joyinfo, _NumPads); - EnablePolling(true); - - return true; -} - // Fill joyinfo with the current connected devices -bool DoLocalSearchDevices(std::vector &_joyinfo, int &_NumPads) +bool Search_Devices(std::vector &_joyinfo, int &_NumPads, int &_NumGoodPads) { - //DEBUG_LOG(WIIMOTE, "LocalSearchDevices"); + bool WasGotten = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads); // Warn the user if no gamepads are detected - if (_NumPads == 0 && g_EmulatorRunning) + if (_NumGoodPads == 0 && g_EmulatorRunning) { - //PanicAlert("Wiimote: No Gamepad Detected"); + //PanicAlert("nJoy: No Gamepad Detected"); //return false; } - // Load the first time - if (!g_Config.Loaded) g_Config.Load(); + // Load PadMapping[] etc + g_Config.Load(); // Update the PadState[].joy handle - // If the saved ID matches, select this device for this slot - bool Match = false; - for (int i = 0; i < MAX_WIIMOTES; i++) - { - for (int j = 0; j < joyinfo.size(); j++) - { - if (joyinfo.at(j).Name == PadMapping[i].Name) - { - PadState[i].joy = joyinfo.at(j).joy; - Match = true; - //INFO_LOG(WIIMOTE, "Slot %i: '%s' %06i", i, joyinfo.at(j).Name.c_str(), PadState[i].joy); - } - } - if (!Match) PadState[i].joy = NULL; - } - - return true; -} - -// Is the device connected? -// ---------------- -bool IsConnected(std::string Name) -{ - for (int i = 0; i < joyinfo.size(); i++) + for (int i = 0; i < 1; i++) { - DEBUG_LOG(WIIMOTE, "Pad %i: IsConnected checking '%s' against '%s'", i, joyinfo.at(i).Name.c_str(), Name.c_str()); - if (joyinfo.at(i).Name == Name) - return true; + if (PadMapping[i].enabled && joyinfo.size() > (u32)PadMapping[i].ID) + if(joyinfo.at(PadMapping[i].ID).Good) + PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID); } -} -// See description of the equivalent functions in nJoy.cpp... -// ---------------- -bool IsPolling() -{ - if (!SDLPolling || SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE) - return false; - else - return true; -} -void EnablePolling(bool Enable) -{ - if (Enable) - { - SDLPolling = true; - SDL_JoystickEventState(SDL_IGNORE); - } - else - { - SDLPolling = false; - SDL_JoystickEventState(SDL_ENABLE); - } -} - -// ID to Name -// ---------------- -std::string IDToName(int ID) -{ - for (int i = 0; i < joyinfo.size(); i++) - { - //DEBUG_LOG(WIIMOTE, "IDToName: ID %i id %i %s", ID, i, joyinfo.at(i).Name.c_str()); - if (joyinfo.at(i).ID == ID) - return joyinfo.at(i).Name; - } - return ""; + return WasGotten; } - // Return adjusted input values void PadStateAdjustments(int &Lx, int &Ly, int &Rx, int &Ry, int &Tl, int &Tr) { @@ -208,20 +119,11 @@ void PadStateAdjustments(int &Lx, int &Ly, int &Rx, int &Ry, int &Tl, int &Tr) Function: Updates the PadState struct with the current pad status. The input value "controller" is for a virtual controller 0 to 3. */ -void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller) +void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons) { - //DEBUG_LOG(WIIMOTE, "GetJoyState: Polling:%i NumPads:%i", SDLPolling, NumPads); - - // Return if polling is off - if (!IsPolling()) return; - // Update joyinfo handles. This is in case the Wiimote plugin has restarted SDL after a pad was conencted/disconnected - // so that the handles are updated. We don't need to run this this often. Once a second would be enough. - if (LiveUpdates) LocalSearchDevices(joyinfo, NumPads); // Return if we have no pads - if (NumPads == 0) return; - // Read info - int NumButtons = SDL_JoystickNumButtons(_PadState.joy); - + if (NumGoodPads == 0) return; + // Update the gamepad status SDL_JoystickUpdate(); @@ -250,13 +152,14 @@ void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONT } #endif - /* Debugging - ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->ClearScreen(); - Console->CustomLog(StringFromFormat( - "Controller: %i Handle: %i\n" - "Triggers: %i %i %i %i %i\n" - "Analog: %06i %06i \n", + /* Debugging +// Console::ClearScreen(); + DEBUG_LOG(CONSOLE, + "Controller and handle: %i %i\n" + + "Triggers:%i %i %i %i %i\n" + + "Analog:%06i %06i \n", controller, (int)_PadState.joy, @@ -265,8 +168,7 @@ void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONT _PadState.Axis.Tl, _PadState.Axis.Tr, _PadState.Axis.Lx, _PadState.Axis.Ly - ).c_str()); - */ + );*/ } diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 29a7044866..aa46c800fe 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -21,7 +21,6 @@ #include #include "Common.h" // Common -#include "LogManager.h" #include "Timer.h" #include "pluginspecs_wiimote.h" #include "StringUtil.h" // For ArrayToString @@ -441,7 +440,7 @@ void SingleShake(u8 &_y, u8 &_z, int i) void TiltWiimoteGamepad(float &Roll, float &Pitch) { // Return if we have no pads - if (NumPads == 0) return; + if (NumGoodPads == 0) return; // This has to be changed if multiple Wiimotes are to be supported later const int Page = 0; diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index fc009f7ff0..1f9dae90ef 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -420,13 +420,11 @@ bool IsFocus() HWND Parent = GetParent(RenderingWindow); HWND TopLevel = GetParent(Parent); // Allow updates when the config window is in focus to - HWND Config = NULL, ConfigPad = NULL, ConfigRecording = NULL; - if (m_BasicConfigFrame) Config = (HWND)m_BasicConfigFrame->GetHWND(); - if (m_PadConfigFrame) ConfigPad = (HWND)m_PadConfigFrame->GetHWND(); - if (m_RecordingConfigFrame) ConfigRecording = (HWND)m_RecordingConfigFrame->GetHWND(); + HWND Config = NULL; + if (m_BasicConfigFrame) + Config = (HWND)m_BasicConfigFrame->GetHWND(); // Support both rendering to main window and not - if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config - || GetForegroundWindow() == ConfigPad || GetForegroundWindow() == ConfigRecording) + if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config) return true; else return false; @@ -759,14 +757,12 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) // --------------------------------------------- // Test the angles to x, y, z values formula by calculating the values back and forth // ----------- - /**/ - ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->ClearScreen(); + /* //Console::ClearScreen(); // Show a test of our calculations WiiMoteEmu::TiltTest(data[4], data[5], data[6]); - //u8 x, y, z; - //WiiMoteEmu::Tilt(x, y, z); - //WiiMoteEmu::TiltTest(x, y, z); + u8 x, y, z; + WiiMoteEmu::Tilt(x, y, z); + WiiMoteEmu::TiltTest(x, y, z);*/ // ------------------------- // --------------------------------------------- diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.h b/Source/Plugins/Plugin_Wiimote/Src/main.h index 8cfcfb31c0..197e351ea2 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.h +++ b/Source/Plugins/Plugin_Wiimote/Src/main.h @@ -35,7 +35,7 @@ int GetUpdateRate(); void InterruptDebugging(bool Emu, const void* _pData); void ReadDebugging(bool Emu, const void* _pData, int Size); bool IsFocus(); -#define MAX_WIIMOTES 1 + // Movement recording #define RECORDING_ROWS 15 diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h index d3892a9fb9..d422785f5e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h @@ -26,6 +26,8 @@ namespace WiiMoteReal { +#define MAX_WIIMOTES 1 + int Initialize(); void DoState(PointerWrap &p); void Shutdown(void); diff --git a/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj b/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj index c933a21557..315b60edfd 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj +++ b/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj @@ -68,7 +68,7 @@ AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib" OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)D.dll" LinkIncremental="2" - AdditionalLibraryDirectories=""..\..\..\Externals\SDL\VisualC\SDL\$(ConfigurationName)";..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" @@ -149,7 +149,7 @@ AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib" OutputFile="..\..\..\Binary\x64\Plugins\$(ProjectName)D.dll" LinkIncremental="2" - AdditionalLibraryDirectories=""..\..\..\Externals\SDL\VisualC\SDL\$(PlatformName)\$(ConfigurationName)";..\..\..\Externals\wxWidgets\lib\vc_lib\x64" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" @@ -228,7 +228,7 @@ AdditionalDependencies="SDL.lib comctl32.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib" OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName).dll" LinkIncremental="1" - AdditionalLibraryDirectories=""..\..\..\Externals\SDL\VisualC\SDL\$(ConfigurationName)";..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" @@ -309,7 +309,7 @@ AdditionalDependencies="SDL.lib comctl32.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib" OutputFile="..\..\..\Binary\x64\Plugins\$(ProjectName).dll" LinkIncremental="1" - AdditionalLibraryDirectories=""..\..\..\Externals\SDL\VisualC\SDL\$(PlatformName)\$(ConfigurationName)";..\..\..\Externals\wxWidgets\lib\vc_lib\x64" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" @@ -390,7 +390,7 @@ AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib" OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)DF.dll" LinkIncremental="1" - AdditionalLibraryDirectories="..\..\..\Externals\SDL\VisualC\SDL\Debug;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" @@ -471,7 +471,7 @@ AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib" OutputFile="..\..\..\Binary\x64\Plugins\$(ProjectName)DF.dll" LinkIncremental="1" - AdditionalLibraryDirectories=""..\..\..\Externals\SDL\VisualC\SDL\$(PlatformName)\Debug";..\..\..\Externals\wxWidgets\lib\vc_lib\x64" + AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64" GenerateManifest="false" GenerateDebugInformation="true" ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb" diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp index ed030d1b2d..28862c8248 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp @@ -46,7 +46,6 @@ Config::Config() { // Clear the memory //memset(this, 0, sizeof(Config)); - Loaded = false; } @@ -96,7 +95,7 @@ void DEBUG_QUIT() void Config::Save(int Slot) { // If there are no good pads don't save - if (NumPads == 0) return; + if (NumGoodPads == 0) return; // Load ini file IniFile file; @@ -128,27 +127,22 @@ void Config::Save(int Slot) // Save the physical device ID file.Set(SectionName.c_str(), "joy_id", PadMapping[i].ID); - file.Set(SectionName.c_str(), "joy_name", PadMapping[i].Name); // =================== // ================================================================== // Joypad or slot specific settings // ----------------- - // Current joypad device ID: PadMapping[i].ID - // Current joypad name: IDToName(PadMapping[i].ID]) + // Current joypad device ID: PadMapping[i].ID + // Current joypad name: joyinfo[PadMapping[i].ID].Name if(g_Config.bSaveByID) { + /* Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to + avoid reading a joyinfo that does't exist */ + if((u32)PadMapping[i].ID >= joyinfo.size()) continue; + // Create a new section name after the joypad name - SectionName = IDToName(PadMapping[i].ID); - // Don't save a blank name - if (SectionName == "") - { - ERROR_LOG(PAD, "ID %i has no name, will not save", PadMapping[i].ID); - continue; - } + SectionName = joyinfo[PadMapping[i].ID].Name; } - - NOTICE_LOG(PAD, "Save settings for ID %i '%s' from PadMapping[%i]", PadMapping[i].ID, SectionName.c_str(), i); file.Set(SectionName.c_str(), "l_shoulder", PadMapping[i].buttons[InputCommon::CTL_L_SHOULDER]); file.Set(SectionName.c_str(), "r_shoulder", PadMapping[i].buttons[InputCommon::CTL_R_SHOULDER]); @@ -186,6 +180,8 @@ void Config::Save(int Slot) file.Set(SectionName.c_str(), "SquareToCircleC", PadMapping[i].bSquareToCircleC); } + INFO_LOG(CONSOLE, "%i: Save: %i\n", 0, PadMapping[0].halfpress); + file.Save(FULL_CONFIG_DIR "nJoy.ini"); } @@ -193,7 +189,8 @@ void Config::Save(int Slot) // ----------------------- void Config::Load(bool ChangePad, bool ChangeSaveByID) { - Loaded = true; + // If there are no good pads don't load + if (NumGoodPads == 0) return; // Load file IniFile file; @@ -214,9 +211,6 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID) } // ============= - // If there are no good pads don't load anymore - if (NumPads == 0) return; - for (int i = 0; i < 4; i++) { std::string SectionName = StringFromFormat("PAD%i", i+1); @@ -225,32 +219,23 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID) if (!ChangePad) { file.Get(SectionName.c_str(), "joy_id", &PadMapping[i].ID, 0); - file.Get(SectionName.c_str(), "joy_name", &PadMapping[i].Name, ""); } // ================================================================== // Joypad or slot specific settings // ----------------- - // Current joypad device ID: PadMapping[i].ID - // Current joypad name: IDToName(PadMapping[i].ID) - if (g_Config.bSaveByID) + // Current joypad device ID: PadMapping[i].ID + // Current joypad name: joyinfo[PadMapping[i].ID].Name + if(g_Config.bSaveByID) { + // Prevent a crash from illegal access to joyinfo that will only have values for + // the current amount of connected pads + if((u32)PadMapping[i].ID >= joyinfo.size()) continue; + // Create a section name - SectionName = PadMapping[i].Name; - // Don't load settings for a non-connected device - if (!IsConnected(SectionName)) - { - ERROR_LOG(PAD, "Slot %i: The device '%s' is not connected, will not load settings", SectionName.c_str()); - continue; - } - // Don't load a blank ID - if (SectionName == "") - { - ERROR_LOG(PAD, "Slot %i has no device name, will not load settings", i); - continue; - } + SectionName = joyinfo[PadMapping[i].ID].Name; } - + file.Get(SectionName.c_str(), "l_shoulder", &PadMapping[i].buttons[InputCommon::CTL_L_SHOULDER], 4); file.Get(SectionName.c_str(), "r_shoulder", &PadMapping[i].buttons[InputCommon::CTL_R_SHOULDER], 5); file.Get(SectionName.c_str(), "a_button", &PadMapping[i].buttons[InputCommon::CTL_A_BUTTON], 0); @@ -284,11 +269,8 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID) file.Get(SectionName.c_str(), "RadiusOnOffC", &Tmp, false); PadMapping[i].bRadiusOnOffC = Tmp; file.Get(SectionName.c_str(), "DiagonalC", &PadMapping[i].SDiagonalC, "100%"); file.Get(SectionName.c_str(), "SquareToCircleC", &Tmp, false); PadMapping[i].bSquareToCircleC = Tmp; - - NOTICE_LOG(PAD, "Slot %i: Load settings for ID %i '%s'", i, PadMapping[i].ID, SectionName.c_str()); - } - //INFO_LOG(PAD, "%i: Load: %i\n", 0, PadMapping[0].halfpress); + INFO_LOG(CONSOLE, "%i: Load: %i\n", 0, PadMapping[0].halfpress); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.h b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.h index 9bcb23524d..3b20ba8919 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.h @@ -23,10 +23,9 @@ struct Config Config(); void Load(bool ChangePad = false, bool ChangeSaveByID = false); void Save(int Slot = -1); - bool Loaded; int CheckForDuplicateJoypads(bool OK); - // Settings + // General bool bShowAdvanced; // Only allow one of these bool bSaveByID; bool bCheckFocus; diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp index a8df0a168e..c9b590d2c2 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp @@ -1,3 +1,4 @@ + // Project description // ------------------- // Name: nJoy @@ -31,15 +32,14 @@ // --------- #include "ConfigBox.h" #include "../nJoy.h" -#include "LogManager.h" #include "Images/controller.xpm" extern bool g_EmulatorRunning; // Set PAD status // -------------- -void PADConfigDialognJoy::PadShowStatus() -{ +void PADConfigDialognJoy::PadGetStatus() +{ // Return if it's not detected. The ID should never be less than zero here, it can only be that // because of a manual ini file change, but we make that check anway. if(PadMapping[notebookpage].ID < 0 || PadMapping[notebookpage].ID >= SDL_NumJoysticks()) @@ -51,7 +51,7 @@ void PADConfigDialognJoy::PadShowStatus() } // Get physical device status - int ID = PadMapping[notebookpage].ID; + int PhysicalDevice = PadMapping[notebookpage].ID; int TriggerType = PadMapping[notebookpage].triggertype; // Get original values @@ -105,6 +105,7 @@ void PADConfigDialognJoy::PadShowStatus() m_bmpDotOutC[notebookpage]->SetPosition(wxPoint(sub_x_out, sub_y_out)); ///////////////////// Analog stick + // Triggers // ----------------- @@ -142,12 +143,84 @@ void PADConfigDialognJoy::PadShowStatus() ///////////////////// Triggers } -// Update the advanced tab +// Show the current pad status +// ----------------- +std::string ShowStatus(int VirtualController) +{ + // Save the physical device + int PhysicalDevice = PadMapping[VirtualController].ID; + + // Make local shortcut + SDL_Joystick *joy = PadState[VirtualController].joy; + + // Make shortcuts for all pads + SDL_Joystick *joy0 = PadState[0].joy; + SDL_Joystick *joy1 = PadState[1].joy; + SDL_Joystick *joy2 = PadState[2].joy; + SDL_Joystick *joy3 = PadState[3].joy; + + // Temporary storage + std::string StrAxes, StrHats, StrBut; + int value; + + // Get status + int Axes = joyinfo[PhysicalDevice].NumAxes; + int Balls = joyinfo[PhysicalDevice].NumBalls; + int Hats = joyinfo[PhysicalDevice].NumHats; + int Buttons = joyinfo[PhysicalDevice].NumButtons; + + // Update the internal values + SDL_JoystickUpdate(); + + // Go through all axes and read out their values + for(int i = 0; i < Axes; i++) + { + value = SDL_JoystickGetAxis(joy, i); + StrAxes += StringFromFormat(" %i:%06i", i, value); + } + for(int i = 0;i < Hats; i++) + { + value = SDL_JoystickGetHat(joy, i); + StrHats += StringFromFormat(" %i:%i", i, value); + } + for(int i = 0;i < Buttons; i++) + { + value = SDL_JoystickGetButton(joy, i); + StrBut += StringFromFormat(" %i:%i", i+1, value); + } + + return StringFromFormat( + "All pads:\n" + "ID: %i %i %i %i\n" + "Controllertype: %i %i %i %i\n" + "SquareToCircle: %i %i %i %i\n\n" + #ifdef _WIN32 + "Handles: %i %i %i %i\n" + "XInput: %i %i %i\n" + #endif + + "This pad:\n" + "Axes: %s\n" + "Hats: %s\n" + "But: %s\n" + "Device: Ax: %i Balls:%i Hats:%i But:%i", + PadMapping[0].ID, PadMapping[1].ID, PadMapping[2].ID, PadMapping[3].ID, + PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype, + PadMapping[0].bSquareToCircle, PadMapping[1].bSquareToCircle, PadMapping[2].bSquareToCircle, PadMapping[3].bSquareToCircle, + #ifdef _WIN32 + joy0, joy1, joy2, joy3, + //PadState[PadMapping[0].ID].joy, PadState[PadMapping[1].ID].joy, PadState[PadMapping[2].ID].joy, PadState[PadMapping[3].ID].joy, + XInput::IsConnected(0), XInput::GetXI(0, InputCommon::XI_TRIGGER_L), XInput::GetXI(0, InputCommon::XI_TRIGGER_R), + #endif + StrAxes.c_str(), StrHats.c_str(), StrBut.c_str(), + Axes, Balls, Hats, Buttons + ); +} + +// Populate the advanced tab // ----------------- void PADConfigDialognJoy::Update() -{ - if (!IsPolling()) return; - +{ // Check that Dolphin is in focus, otherwise don't update the pad status /* If the emulator is running and unpaused GetJoyState() is run a little more often than needed, but I allow that since it can confuse the user if the input status in the configuration window @@ -155,46 +228,17 @@ void PADConfigDialognJoy::Update() if (g_Config.bCheckFocus || IsFocus()) // && !g_EmulatorRunning) { for (int i = 0; (u32)i < joyinfo.size(); i++) - InputCommon::GetJoyState(PadState[notebookpage], PadMapping[notebookpage]); - PadShowStatus(); + InputCommon::GetJoyState(PadState[i], PadMapping[i], i, joyinfo[PadMapping[i].ID].NumButtons); } // Show the current status in a window in the wxPanel #ifdef SHOW_PAD_STATUS - m_pStatusBar->SetLabel(wxString::FromAscii(InputCommon::ShowStatus( - notebookpage, m_Joyname[notebookpage]->GetSelection(), - PadMapping, PadState, joyinfo - ).c_str())); + m_pStatusBar->SetLabel(wxString::Format( + "%s", ShowStatus(notebookpage).c_str() + )); #endif } -// Search for devices -void PADConfigDialognJoy::UpdateSlow() -{ - if (!LiveUpdates) return; - - // Don't run this the first time - int OldNumDIDevices; - if (NumDIDevices == -1) - OldNumDIDevices = InputCommon::SearchDIDevices(); - else - // Search for connected devices and update dialog - OldNumDIDevices = NumDIDevices; - NumDIDevices = InputCommon::SearchDIDevices(); - - // Update if a pad has been connected/disconnected. Todo: Add a better check that also takes into consideration the pad id - // and other things to better ensure that nothing has changed - //DEBUG_LOG(PAD, "Found %i devices", NumDIDevices); - //DEBUG_LOG(PAD, "UpdateSlow: %i %i", OldNumPads, NumPads); - if (OldNumDIDevices != NumDIDevices) - { - WARN_LOG(PAD, "\n---- %s ----", (NumDIDevices > OldNumDIDevices) ? "Pad connected" : "Pad disconnected"); - LocalSearchDevicesReset(joyinfo, NumPads); - UpdateDeviceList(); - // Enable controls again, if disabled - UpdateGUIAll(); - } -} // Populate the advanced tab // ----------------- @@ -324,5 +368,6 @@ wxBitmap PADConfigDialognJoy::CreateBitmapArea(int Max, int Diagonal) Points[7].x = (int)(-Diagonal * Adj + iAdj); Points[7].y = (int)(Diagonal * Adj + iAdj); // Draw polygon dc.DrawPolygon(8, Points); + return bitmap; } \ No newline at end of file diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index e77bb496a4..d4a342a48f 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -103,7 +103,6 @@ BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog) EVT_BUTTON(IDB_ANALOG_SUB_Y, PADConfigDialognJoy::GetButtons) #if wxUSE_TIMER - EVT_TIMER(IDTM_SLOW, PADConfigDialognJoy::OnSlowTimer) EVT_TIMER(IDTM_CONSTANT, PADConfigDialognJoy::OnTimer) EVT_TIMER(IDTM_BUTTON, PADConfigDialognJoy::OnButtonTimer) #endif @@ -113,34 +112,26 @@ PADConfigDialognJoy::PADConfigDialognJoy(wxWindow *parent, wxWindowID id, const const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { - // Initialize values + // Define values notebookpage = 0; - g_Pressed = 0; + g_Pressed = 0; + Debugging = false; m_TCDebugging = NULL; ControlsCreated = false; - - // Settings - Debugging = false; // Create controls CreateGUIControls(); - - // Update GUI - UpdateGUIAll(); - - // Update device list - UpdateDeviceList(); #if wxUSE_TIMER - m_SlowTimer = new wxTimer(this, IDTM_SLOW); m_ConstantTimer = new wxTimer(this, IDTM_CONSTANT); m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON); // Reset values GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; - // Start timers - StartTimer(); + // Start the constant timer + int TimesPerSecond = 30; + m_ConstantTimer->Start( floor((double)(1000 / TimesPerSecond)) ); #endif // wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys @@ -157,24 +148,6 @@ PADConfigDialognJoy::~PADConfigDialognJoy() #endif } -void PADConfigDialognJoy::DoShow() -{ - // Start timers - StartTimer(); - // Show - ShowModal(); -} - -void PADConfigDialognJoy::StartTimer() -{ - // Start the slow timer - double TimesPerSecond = 2; - m_SlowTimer->Start( floor((double)(1000.0 / TimesPerSecond)) ); - // Start the constant timer - TimesPerSecond = 30; - m_ConstantTimer->Start( floor((double)(1000 / TimesPerSecond)) ); -} - void PADConfigDialognJoy::OnKeyDown(wxKeyEvent& event) { g_Pressed = event.GetKeyCode(); @@ -187,9 +160,7 @@ void PADConfigDialognJoy::OnClose(wxCloseEvent& event) event.Skip(); // Stop the timer - m_SlowTimer->Stop(); m_ConstantTimer->Stop(); - m_ButtonMappingTimer->Stop(); // Close pads, unless we are running a game if (!g_EmulatorRunning) Shutdown(); @@ -285,7 +256,7 @@ void PADConfigDialognJoy::DoSave(bool ChangePad, int Slot) g_Config.Save(Slot); // Now we can update the ID - UpdateID(); + PadMapping[notebookpage].ID = m_Joyname[notebookpage]->GetSelection(); } else { @@ -297,21 +268,6 @@ void PADConfigDialognJoy::DoSave(bool ChangePad, int Slot) // Then change it back to "" ToBlank(); } -void PADConfigDialognJoy::UpdateID() -{ - INFO_LOG(PAD, "Slot %i: Changed PadMapping ID from %i to %i", notebookpage, PadMapping[notebookpage].ID, m_Joyname[notebookpage]->GetSelection()); - PadMapping[notebookpage].ID = joyinfo.at(m_Joyname[notebookpage]->GetSelection()).ID; - PadMapping[notebookpage].Name = joyinfo.at(m_Joyname[notebookpage]->GetSelection()).Name; - // Update all handles - for(int i = 0; i < 4; i++) - { - if (PadMapping[i].Name == PadMapping[notebookpage].Name) - { - if (m_Joyname[i]->GetSelection() >= 0 && joyinfo.size() > m_Joyname[i]->GetSelection()) - PadState[i].joy = joyinfo.at(m_Joyname[i]->GetSelection()).joy; - } - } -} // On changing the SaveById option we update all pages void PADConfigDialognJoy::OnSaveById() @@ -334,52 +290,11 @@ void PADConfigDialognJoy::OnSaveById() void PADConfigDialognJoy::DoChangeJoystick() { // Before changing the pad we save potential changes to the current pad (to support SaveByID) - WARN_LOG(PAD, "\n--- DoChangeJoystick ----"); - WARN_LOG(PAD, "DoSave"); DoSave(true); - // Load the settings for the new ID - WARN_LOG(PAD, "Load"); + // Load the settings for the new Id g_Config.Load(true); - // Update the GUI - WARN_LOG(PAD, "UpdateGUI"); - UpdateGUI(notebookpage); - WARN_LOG(PAD, ""); -} -// Pads have been connected/disconnected -void PADConfigDialognJoy::UpdateDeviceList() -{ - if (!ControlsCreated) return; - - DEBUG_LOG(PAD, "UpdateDeviceList"); - - for (int i = 0; i < 4; i++) - { - // Save current selection - //std::string CurrentSel = m_Joyname[i]->GetValue().mb_str(); - m_Joyname[i]->Clear(); - - // Search for devices and add them to the device list - if (joyinfo.size() > 0) - { - for (int j = 0; j < joyinfo.size(); j++) - m_Joyname[i]->Append(wxString::FromAscii(joyinfo.at(j).Name.c_str())); - // Set selection - //PanicAlert("%s", PadMapping[i].Name.c_str()); - for (int j = 0; j < joyinfo.size(); j++) - { - if (joyinfo.at(j).Name == PadMapping[i].Name) m_Joyname[i]->SetSelection(j); - } - if (m_Joyname[i]->GetSelection() == -1) m_Joyname[i]->SetSelection(0); - // Load settings - DoChangeJoystick(); - } - else - { - m_Joyname[i]->Append(wxString::FromAscii("")); - m_Joyname[i]->SetSelection(0); - } - } + UpdateGUI(notebookpage); // Update the GUI } // Notebook page changed @@ -388,7 +303,7 @@ void PADConfigDialognJoy::NotebookPageChanged(wxNotebookEvent& event) // Save current settings now, don't wait for OK if (ControlsCreated && !g_Config.bSaveByID) DoSave(false, notebookpage); - // Update the global variable + // Update the global variable notebookpage = event.GetSelection(); // Update GUI @@ -420,28 +335,28 @@ void PADConfigDialognJoy::ToBlank(bool ToBlank) } -// Change settings for all slots that have this pad selected -// ----------------------- +// Change settings void PADConfigDialognJoy::SetButtonTextAll(int id, const char *text) { for (int i = 0; i < 4; i++) { - if (IDToName(PadMapping[i].ID) == IDToName(PadMapping[notebookpage].ID)) - { - SetButtonText(id, text, i); - DEBUG_LOG(PAD, "Updated button text for slot %i", i); - } + // Safety check to avoid crash + if (joyinfo.size() > (u32)PadMapping[i].ID) + if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[notebookpage].ID].Name) + SetButtonText(id, text, i); }; } + void PADConfigDialognJoy::SaveButtonMappingAll(int Slot) { for (int i = 0; i < 4; i++) { - if (PadMapping[i].Name.length() > 0 && PadMapping[i].Name == PadMapping[Slot].Name) - SaveButtonMapping(i, false, Slot); + // This can occur when no gamepad is detected + if (joyinfo.size() > (u32)PadMapping[i].ID) + if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name) + SaveButtonMapping(i, false, Slot); } } -// ----------------------- void PADConfigDialognJoy::UpdateGUIAll(int Slot) { @@ -453,8 +368,10 @@ void PADConfigDialognJoy::UpdateGUIAll(int Slot) { for (int i = 0; i < 4; i++) { - if (IDToName(PadMapping[i].ID) == IDToName(PadMapping[Slot].ID)) - UpdateGUI(i); + // Safety check to avoid crash + if (joyinfo.size() > (u32)PadMapping[i].ID) + if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name) + UpdateGUI(i); } } } @@ -521,10 +438,8 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event ) } // Update all slots that use this device - //if(g_Config.bSaveByID) - SaveButtonMappingAll(notebookpage); - //if(g_Config.bSaveByID) - UpdateGUIAll(notebookpage); + if(g_Config.bSaveByID) SaveButtonMappingAll(notebookpage); + if(g_Config.bSaveByID) UpdateGUIAll(notebookpage); } @@ -532,18 +447,12 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event ) // Called from: CreateGUIControls(), ChangeControllertype() void PADConfigDialognJoy::UpdateGUI(int _notebookpage) { - DEBUG_LOG(PAD, "UpdateGUI for slot %i, %i pads connected", _notebookpage, NumPads); - // If there are no good pads disable the entire notebook - if (NumPads == 0) + if (NumGoodPads == 0) { m_Notebook->Enable(false); return; } - else - { - m_Notebook->Enable(true); - } // Update the GUI from PadMapping[] UpdateGUIButtonMapping(_notebookpage); @@ -596,8 +505,6 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage) else m_CoBRadiusC[_notebookpage]->Enable(false); if (PadMapping[_notebookpage].bSquareToCircleC) m_CoBDiagonalC[_notebookpage]->Enable(true); else m_CoBDiagonalC[_notebookpage]->Enable(false); - - DEBUG_LOG(PAD, "Main radius %s", PadMapping[_notebookpage].bRadiusOnOff ? "enabled" : "disabled"); } // Repaint the background @@ -658,9 +565,24 @@ void PADConfigDialognJoy::CreateGUIControls() m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_Controller[3], wxT("Controller 4")); + // Define bitmap for EVT_PAINT WxStaticBitmap1_BITMAP = wxBitmap(ConfigBox_WxStaticBitmap1_XPM); + // Search for devices and add them to the device list + wxArrayString arrayStringFor_Joyname; // The string array + if (NumGoodPads > 0) + { + for(int x = 0; (u32)x < joyinfo.size(); x++) + { + arrayStringFor_Joyname.Add(wxString::FromAscii(joyinfo[x].Name.c_str())); + } + } + else + { + arrayStringFor_Joyname.Add(wxString::FromAscii("")); + } + // Populate the DPad type and Trigger type list wxArrayString wxAS_DPadType; wxAS_DPadType.Add(wxString::FromAscii(DPadType[InputCommon::CTL_DPAD_HAT])); @@ -799,9 +721,9 @@ void PADConfigDialognJoy::CreateGUIControls() // Populate Controller sizer // Groups #ifdef _WIN32 - m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, wxEmptyString, wxDefaultPosition, wxSize(476, 21), 0, NULL, wxCB_READONLY); + m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(476, 21), arrayStringFor_Joyname, wxCB_READONLY); #else - m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, wxEmptyString, wxDefaultPosition, wxSize(450, 25), 0, NULL, wxCB_READONLY); + m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(450, 25), arrayStringFor_Joyname, 0, wxDefaultValidator, wxT("m_Joyname")); #endif m_gJoyname[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Controller")); @@ -1032,6 +954,9 @@ void PADConfigDialognJoy::CreateGUIControls() // Show or hide it. We have to do this after we add it to its sizer m_sMainRight[i]->Show(g_Config.bShowAdvanced); + + // Update GUI + UpdateGUI(i); } // end of loop // Populate buttons sizer. @@ -1050,7 +975,7 @@ void PADConfigDialognJoy::CreateGUIControls() // Debugging #ifdef SHOW_PAD_STATUS - m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(135, 100), wxSize(200, -1)); + m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(135, 100), wxDefaultSize); #endif // Set window size diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h index 041bf77e9c..a0a5fa7b84 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h @@ -62,17 +62,12 @@ class PADConfigDialognJoy : public wxDialog long style = wxDEFAULT_DIALOG_STYLE); virtual ~PADConfigDialognJoy(); - // Timers #if wxUSE_TIMER - void OnSlowTimer(wxTimerEvent& WXUNUSED(event)) { UpdateSlow(); } void OnTimer(wxTimerEvent& WXUNUSED(event)) { Update(); } void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); } - wxTimer *m_SlowTimer, *m_ConstantTimer, *m_ButtonMappingTimer; + wxTimer *m_ConstantTimer, *m_ButtonMappingTimer; #endif - // Functions - void DoShow(); - // Debugging wxStaticText* m_pStatusBar, * m_pStatusBar2; wxTextCtrl* m_TCDebugging; @@ -200,10 +195,7 @@ class PADConfigDialognJoy : public wxDialog *m_bmpSquare[4], *m_bmpDot[4], *m_bmpSquareOut[4], *m_bmpDotOut[4], *m_bmpAreaOut[4], *m_bmpSquareC[4], *m_bmpDotC[4], *m_bmpSquareOutC[4], *m_bmpDotOutC[4], *m_bmpAreaOutC[4]; - // Settings - int notebookpage; - bool ControlsCreated; - bool LiveUpdates; + int notebookpage; bool ControlsCreated; private: enum @@ -241,7 +233,7 @@ class PADConfigDialognJoy : public wxDialog IDT_TRIGGERS, IDCB_CHECKFOCUS, IDCB_FILTER_SETTINGS, // Timers - IDTM_SLOW, IDTM_CONSTANT, IDTM_BUTTON, + IDTM_CONSTANT, IDTM_BUTTON, // ============================================== @@ -324,8 +316,6 @@ class PADConfigDialognJoy : public wxDialog void OKClick(wxCommandEvent& event); void CancelClick(wxCommandEvent& event); void DoSave(bool ChangePad = false, int Slot = -1); - void UpdateID(); - void StartTimer(); void DoChangeJoystick(); @@ -333,22 +323,20 @@ class PADConfigDialognJoy : public wxDialog void ChangeSettings(wxCommandEvent& event); void ComboChange(wxCommandEvent& event); - + void OnClose(wxCloseEvent& event); - void UpdateDeviceList(); void CreateGUIControls(); void CreateAdvancedControls(int i); wxBitmap CreateBitmap(); wxBitmap CreateBitmapDot(); wxBitmap CreateBitmapArea(int,int); - void PadShowStatus(); - void UpdateSlow(); + void PadGetStatus(); void Update(); void UpdateGUIButtonMapping(int controller); void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1); void SaveButtonMappingAll(int Slot); - void UpdateGUIAll(int Slot = -1); + void UpdateGUIAll(int Slot); void ToBlank(bool ToBlank = true); void OnSaveById(); diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigJoypad.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigJoypad.cpp index 68c69b1fb8..e0dc1341e0 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigJoypad.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigJoypad.cpp @@ -50,11 +50,8 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller) // http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString wxString tmp; - // Assert - //if (!ControlsCreated[i]) return; - // Update selected gamepad - m_Joyname[controller]->SetValue(wxString::FromAscii(PadMapping[controller].Name.c_str())); + m_Joyname[controller]->SetSelection(PadMapping[controller].ID); tmp << PadMapping[controller].buttons[InputCommon::CTL_L_SHOULDER]; m_JoyShoulderL[controller]->SetValue(tmp); tmp.clear(); tmp << PadMapping[controller].buttons[InputCommon::CTL_R_SHOULDER]; m_JoyShoulderR[controller]->SetValue(tmp); tmp.clear(); @@ -102,8 +99,7 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller) tmp << PadMapping[controller].dpad2[InputCommon::CTL_D_PAD_LEFT]; m_JoyDpadLeft[controller]->SetValue(tmp); tmp.clear(); tmp << PadMapping[controller].dpad2[InputCommon::CTL_D_PAD_RIGHT]; m_JoyDpadRight[controller]->SetValue(tmp); tmp.clear(); } - - NOTICE_LOG(PAD, "Loaded from PadMapping[%i] to slot %i", controller, controller); + } /* Populate the PadMapping array with the dialog items settings (for example @@ -121,21 +117,7 @@ void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, i ToBlank(false); // Set other settings - if(!DontChangeId) - { - if (joyinfo.size() > m_Joyname[FromSlot]->GetSelection()) - { - INFO_LOG(PAD, "%i: Changed PadMapping ID from %i to %i", controller, PadMapping[controller].ID, joyinfo.at(m_Joyname[FromSlot]->GetSelection()).ID); - PadMapping[controller].ID = joyinfo.at(m_Joyname[FromSlot]->GetSelection()).ID; - } - //else - // Assert - PadMapping[controller].Name = m_Joyname[FromSlot]->GetValue().mb_str(); - } - - NOTICE_LOG(PAD, "Saved PadMapping[%i] from slot %i", controller, FromSlot); - - // Settings + if(!DontChangeId) PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection(); PadMapping[controller].controllertype = m_ControlType[FromSlot]->GetSelection(); PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection(); PadMapping[controller].deadzone = m_Deadzone[FromSlot]->GetSelection(); @@ -282,13 +264,6 @@ void PADConfigDialognJoy::GetButtons(wxCommandEvent& event) void PADConfigDialognJoy::DoGetButtons(int GetId) { - //INFO_LOG(PAD, "DoGetButtons: %i", GetId); - - if (!SDLPolling || SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE) return; - - // Turn off live updates because the change the joy handles - LiveUpdates = false; - // ============================================= // Collect the starting values // ---------------- @@ -305,7 +280,7 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) int Axes = SDL_JoystickNumAxes(joy); int Hats = SDL_JoystickNumHats(joy); - //NOTICE_LOG(PAD, "PadID: %i Axes: %i Handle: %i\n", PadID, joyinfo[PadID].NumAxes, joyinfo[PadID].joy); + INFO_LOG(CONSOLE, "PadID: %i Axes: %i\n", PadID, joyinfo[PadID].NumAxes, joyinfo[PadID].joy); // Get the controller and trigger type int ControllerType = PadMapping[Controller].controllertype; @@ -368,8 +343,6 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) #if wxUSE_TIMER m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) ); #endif - - //INFO_LOG(PAD, "Timer started"); } // =============================================== @@ -380,7 +353,7 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) else { InputCommon::GetButton( - joy, PadID, + joy, PadID, Buttons, Axes, Hats, g_Pressed, value, type, pressed, Succeed, Stop, LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); } @@ -395,7 +368,7 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) GetButtonWaitingTimer++; // This is run every second - if (GetButtonWaitingTimer % TimesPerSecond == 0) + if(GetButtonWaitingTimer % TimesPerSecond == 0) { // Current time int TmpTime = Seconds - (GetButtonWaitingTimer / TimesPerSecond); @@ -406,7 +379,7 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) } // Time's up - if ( (GetButtonWaitingTimer / TimesPerSecond) >= Seconds ) + if( (GetButtonWaitingTimer / TimesPerSecond) >= Seconds ) { Stop = true; // Leave a blank mapping @@ -414,10 +387,8 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) } // If we got a button - if (Succeed) + if(Succeed) { - //INFO_LOG(PAD, "Button mapping succeeded: %i", pressed); - Stop = true; // Write the number of the pressed button to the text box sprintf(format, "%d", pressed); @@ -425,12 +396,10 @@ void PADConfigDialognJoy::DoGetButtons(int GetId) } // Stop the timer - if (Stop) + if(Stop) { m_ButtonMappingTimer->Stop(); GetButtonWaitingTimer = 0; - LiveUpdates = true; - //INFO_LOG(PAD, "Timer stopped"); /* Update the button mapping for all slots that use this device. (It doesn't make sense to have several slots controlled by the same device, but several DirectInput instances of different but identical devices may possible diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 48d8054c15..df25836922 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -48,13 +48,7 @@ std::vector joyinfo; InputCommon::CONTROLLER_STATE PadState[4]; InputCommon::CONTROLLER_MAPPING PadMapping[4]; bool g_EmulatorRunning = false; -bool SDLPolling = true; -#ifdef _WIN32 -bool LiveUpdates = false; -#else -bool LiveUpdates = false; -#endif -int NumPads = 0, NumDIDevices = -1, LastPad = 0; +int NumPads = 0, NumGoodPads = 0, LastPad = 0; #ifdef _WIN32 HWND m_hWnd = NULL, m_hConsole = NULL; // Handle to window #endif @@ -160,9 +154,11 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) // ------------------ void DllConfig(HWND _hParent) { + // Init Joystick + Haptic (force feedback) subsystem on SDL 1.3 // Populate joyinfo for all attached devices - LocalSearchDevices(joyinfo, NumPads); - //g_Config.Load(); // load settings + Search_Devices(joyinfo, NumPads, NumGoodPads); + + g_Config.Load(); // load settings #if defined(HAVE_WX) && HAVE_WX if (!m_ConfigFrame) @@ -172,9 +168,9 @@ void DllConfig(HWND _hParent) // Only allow one open at a time if (!m_ConfigFrame->IsShown()) - m_ConfigFrame->DoShow(); + m_ConfigFrame->ShowModal(); else - m_ConfigFrame->Hide(); + m_ConfigFrame->Hide(); #endif } @@ -198,7 +194,7 @@ void Initialize(void *init) #endif // Populate joyinfo for all attached devices - LocalSearchDevices(joyinfo, NumPads); + Search_Devices(joyinfo, NumPads, NumGoodPads); } // Shutdown PAD (stop emulation) @@ -225,16 +221,18 @@ void Shutdown() for (int i = 0; i < 4; i++) { if (joyinfo.size() > (u32)PadMapping[i].ID) - if(SDL_JoystickOpened(PadMapping[i].ID)) - { - SDL_JoystickClose(PadState[i].joy); - PadState[i].joy = NULL; - } + if (joyinfo.at(PadMapping[i].ID).Good) + if(SDL_JoystickOpened(PadMapping[i].ID)) + { + SDL_JoystickClose(PadState[i].joy); + PadState[i].joy = NULL; + } } // Clear the physical device info joyinfo.clear(); NumPads = 0; + NumGoodPads = 0; // Finally close SDL SDL_Quit(); @@ -285,12 +283,6 @@ void DoState(unsigned char **ptr, int mode) // Function: Gives the current pad status to the Core void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) { - if (!IsPolling()) return; - - // Update joyinfo handles. This is in case the Wiimote plugin has restarted SDL after a pad was conencted/disconnected - // so that the handles are updated. - if (LiveUpdates) LocalSearchDevices(joyinfo, NumPads); - // Check if the pad is avaliable, currently we don't disable pads just because they are // disconnected if (!PadState[_numPAD].joy) return; @@ -300,7 +292,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) // Check that Dolphin is in focus, otherwise don't update the pad status if (g_Config.bCheckFocus || IsFocus()) - GetJoyState(PadState[_numPAD], PadMapping[_numPAD]); + GetJoyState(PadState[_numPAD], PadMapping[_numPAD], _numPAD, joyinfo[PadMapping[_numPAD].ID].NumButtons); // Get type int TriggerType = PadMapping[_numPAD].triggertype; @@ -447,127 +439,29 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) // Search for SDL devices // ---------------- - -bool LocalSearchDevices(std::vector &_joyinfo, int &_NumPads) +bool Search_Devices(std::vector &_joyinfo, int &_NumPads, int &_NumGoodPads) { - //DEBUG_LOG(PAD, "LocalSearchDevices"); - bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads); - - DoLocalSearchDevices(_joyinfo, _NumPads); - - return Success; -} + bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads); -bool LocalSearchDevicesReset(std::vector &_joyinfo, int &_NumPads) -{ - //DEBUG_LOG(PAD, "LocalSearchDevicesUpdate: %i", IsPolling()); - // Turn off device polling while resetting - EnablePolling(false); - bool Success = InputCommon::SearchDevicesReset(_joyinfo, _NumPads); - DoLocalSearchDevices(_joyinfo, _NumPads); - EnablePolling(true); - - return Success; -} - - -bool DoLocalSearchDevices(std::vector &_joyinfo, int &_NumPads) -{ - // Don't warn the user if no gamepads are detected. If the pad doesn't respond he will open the configuration and fix it. - // Also, if he's using a Wii game he may not care that the gamepad is turned off. - if (_NumPads == 0 && g_EmulatorRunning) + // Warn the user if no gamepads are detected + if (_NumGoodPads == 0 && g_EmulatorRunning) { - //PanicAlert("nJoy: No Gamepad Detected"); + PanicAlert("nJoy: No Gamepad Detected"); return false; } - // Load the first time - if (!g_Config.Loaded) g_Config.Load(); + // Load PadMapping[] etc + g_Config.Load(); // Update the PadState[].joy handle for (int i = 0; i < 4; i++) { - for (int j = 0; j < joyinfo.size(); j++) - { - if (joyinfo.at(j).Name == PadMapping[i].Name) - { - PadState[i].joy = joyinfo.at(j).joy; - //DEBUG_LOG(PAD, "Slot %i: %s", i, joyinfo.at(j).Name.c_str()); - } - } + if (joyinfo.size() > (u32)PadMapping[i].ID) + if(joyinfo.at(PadMapping[i].ID).Good) + PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID); } - return true; -} - - -// Is the device connected? -// ---------------- -bool IsConnected(std::string Name) -{ - for (int i = 0; i < joyinfo.size(); i++) - { - //DEBUG_LOG(PAD, "IDToName: ID %i id %i %s", ID, i, joyinfo.at(i).Name.c_str()); - if (joyinfo.at(i).Name == Name) - return true; - } -} - -// It could be possible to crash SDL.dll if SDL functions are called during SDL_Quit/SDL_Init. Therefore these functions. -// ---------------- -bool IsPolling() -{ - if (!SDLPolling || SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE) - return false; - else - return true; -} -void EnablePolling(bool Enable) -{ - if (Enable) - { - SDLPolling = true; - SDL_JoystickEventState(SDL_IGNORE); - } - else - { - SDLPolling = false; - SDL_JoystickEventState(SDL_ENABLE); - } -} - -// ID to Name -// ---------------- -std::string IDToName(int ID) -{ - for (int i = 0; i < joyinfo.size(); i++) - { - //DEBUG_LOG(PAD, "IDToName: ID %i id %i %s", ID, i, joyinfo.at(i).Name.c_str()); - if (joyinfo.at(i).ID == ID) - return joyinfo.at(i).Name; - } - return ""; -} - -// ID to id - Get the gamepad id from a device ID (the ids will be all or some of the IDs) -// ---------------- -int IDToid(int ID) -{ - for (int i = 0; i < joyinfo.size(); i++) - { - if (joyinfo.at(i).ID == ID) - return i; - } - if (joyinfo.size() > 0) - { - ERROR_LOG(PAD, "IDToid error"); - return 0; - } - else - { - PanicAlert("Error in IDToid. The plugin may crash."); - return -1; - } + return Success; } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 7ae50fcabf..54e274a3ed 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -95,24 +95,13 @@ #ifdef _WIN32 extern HWND m_hWnd, m_hConsole; // Handle to window #endif - extern int NumPads, NumDIDevices, LastPad; // Number of pads - extern bool SDLPolling; - extern bool LiveUpdates; + extern int NumPads, NumGoodPads, LastPad; // Number of goods pads #endif // Custom Functions // ---------------- -bool LocalSearchDevices(std::vector &_joyinfo, int &_NumPads); -bool LocalSearchDevicesReset(std::vector &_joyinfo, int &_NumPads); -bool DoLocalSearchDevices(std::vector &_joyinfo, int &_NumPads); -int SearchDIDevices(); -bool IsConnected(std::string Name); -bool IsPolling(); -void EnablePolling(bool Enable); -std::string IDToName(int ID); -bool IsConnected(std::string Name); -int IDToid(int ID); +bool Search_Devices(std::vector &_joyinfo, int &_NumPads, int &_NumGoodPads); void DEBUG_INIT(); void DEBUG_QUIT(); bool IsFocus();