Unverified Commit 40a9f41b authored by Nadia Holmquist Pedersen's avatar Nadia Holmquist Pedersen Committed by GitHub
Browse files

Merge branch 'master' into fix/aarch64-ci

parents 5c08207f dff14ca8
......@@ -102,6 +102,8 @@ public:
bool IsEmpty() { return NumOccupied == 0; }
bool IsFull() { return NumOccupied >= NumEntries; }
bool CanFit(u32 num) { return ((NumOccupied + num) <= NumEntries); }
private:
u32 NumEntries;
T* Entries;
......
......@@ -1815,14 +1815,14 @@ void debug(u32 param)
}
fclose(shit);*/
FILE*
/*shit = fopen("debug/dump9.bin", "wb");
shit = fopen("debug/dump9.bin", "wb");
for (u32 i = 0x02000000; i < 0x04000000; i+=4)
{
u32 val = DSi::ARM9Read32(i);
fwrite(&val, 4, 1, shit);
}
fclose(shit);*/
shit = fopen("debug/dump7_2.bin", "wb");
fclose(shit);
shit = fopen("debug/dump7.bin", "wb");
for (u32 i = 0x02000000; i < 0x04000000; i+=4)
{
u32 val = DSi::ARM7Read32(i);
......
......@@ -106,7 +106,6 @@ u8 BCD(u8 val)
void ByteIn(u8 val)
{
//printf("RTC IN: %02X\n", val);
if (InputPos == 0)
{
if ((val & 0xF0) == 0x60)
......@@ -175,7 +174,6 @@ void ByteIn(u8 val)
case 0x70: Output[0] = FreeReg; break;
}
}
InputPos++;
return;
}
......@@ -221,8 +219,6 @@ void ByteIn(u8 val)
if (InputPos == 1) FreeReg = val;
break;
}
InputPos++;
}
......
......@@ -162,22 +162,26 @@ void Reset()
UserSettings = userdata;
// fix touchscreen coords
#if 0
*(u16*)&Firmware[userdata+0x58] = 0;
*(u16*)&Firmware[userdata+0x5A] = 0;
Firmware[userdata+0x5C] = 0;
Firmware[userdata+0x5D] = 0;
*(u16*)&Firmware[userdata+0x5E] = 255<<4;
*(u16*)&Firmware[userdata+0x60] = 191<<4;
Firmware[userdata+0x62] = 255;
Firmware[userdata+0x63] = 191;
// disable autoboot
//Firmware[userdata+0x64] &= 0xBF;
*(u16*)&Firmware[userdata+0x72] = CRC16(&Firmware[userdata], 0x70, 0xFFFF);
// TODO evetually: do this in DSi mode
if (NDS::ConsoleType == 0)
{
// fix touchscreen coords
*(u16*)&Firmware[userdata+0x58] = 0;
*(u16*)&Firmware[userdata+0x5A] = 0;
Firmware[userdata+0x5C] = 0;
Firmware[userdata+0x5D] = 0;
*(u16*)&Firmware[userdata+0x5E] = 255<<4;
*(u16*)&Firmware[userdata+0x60] = 191<<4;
Firmware[userdata+0x62] = 255;
Firmware[userdata+0x63] = 191;
// disable autoboot
//Firmware[userdata+0x64] &= 0xBF;
*(u16*)&Firmware[userdata+0x72] = CRC16(&Firmware[userdata], 0x70, 0xFFFF);
}
#if 0
// replace MAC address with random address
// TODO: make optional?
Firmware[0x36] = 0x00;
......
......@@ -188,6 +188,8 @@ void Reset()
IOPORT(0x000) = 0x1440;
else if (console == 0x20)
IOPORT(0x000) = 0xC340;
else if (NDS::ConsoleType == 1 && console == 0x57)
IOPORT(0x000) = 0xC340; // DSi has the modern DS-wifi variant
else
{
printf("wifi: unknown console type %02X\n", console);
......
......@@ -30,9 +30,6 @@
namespace WifiAP
{
#define AP_MAC 0x00, 0xF0, 0x77, 0x77, 0x77, 0x77
#define AP_NAME "melonAP"
const u8 APMac[6] = {AP_MAC};
#define PWRITE_8(p, v) *p++ = v;
......@@ -130,6 +127,18 @@ void USTimer()
}
}
void MSTimer()
{
USCounter += 0x400;
u32 chk = (u32)USCounter;
if (!(chk & 0x1FC00))
{
// send beacon every 128ms
BeaconDue = true;
}
}
int HandleManagementFrame(u8* data, int len)
{
......
......@@ -22,11 +22,17 @@
namespace WifiAP
{
#define AP_MAC 0x00, 0xF0, 0x77, 0x77, 0x77, 0x77
#define AP_NAME "melonAP"
extern const u8 APMac[6];
bool Init();
void DeInit();
void Reset();
void USTimer();
void MSTimer();
// packet format: 12-byte TX header + original 802.11 frame
int SendPacket(u8* data, int len);
......
......@@ -46,7 +46,9 @@ set(CMAKE_AUTORCC ON)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Iconv REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(SLIRP REQUIRED slirp)
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release))
add_executable(melonDS WIN32 ${SOURCES_QT_SDL})
......@@ -57,15 +59,20 @@ endif()
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS})
target_include_directories(melonDS PRIVATE ${SLIRP_INCLUDE_DIRS})
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_link_libraries(melonDS core)
if (BUILD_STATIC)
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
target_link_libraries(melonDS -static ${SDL2_STATIC_LIBRARIES} ${SLIRP_STATIC_LIBRARIES})
else()
target_link_libraries(melonDS ${SDL2_LIBRARIES})
target_link_libraries(melonDS ${SDL2_LIBRARIES} ${SLIRP_LIBRARIES})
endif()
if (NOT Iconv_IS_BUILT_IN)
target_link_libraries(melonDS iconv)
endif()
if (UNIX)
......
This diff is collapsed.
......@@ -1285,6 +1285,8 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
{
if (event->isAutoRepeat()) return;
if (event->key() == Qt::Key_F11) NDS::debug(0);
Input::KeyPress(event);
}
......@@ -2083,12 +2085,12 @@ int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdsho
if (argv_w) LocalFree(argv_w);
if (AttachConsole(ATTACH_PARENT_PROCESS))
/*if (AttachConsole(ATTACH_PARENT_PROCESS))
{
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
printf("\n");
}
}*/
int ret = main(argc, argv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment