Update 3DSController to modern libctru
This commit is contained in:
parent
adfa864a99
commit
4eaedf8b7f
11 changed files with 159 additions and 20 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -47,7 +47,7 @@ CFLAGS := -g -Wall -O2 -mword-relocations \
|
|||
-fms-extensions \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
|
||||
CFLAGS += $(INCLUDE) -D__3DS__
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
|
|
134
3DS/compile_commands.json
Normal file
134
3DS/compile_commands.json
Normal file
|
@ -0,0 +1,134 @@
|
|||
[
|
||||
{
|
||||
"arguments": [
|
||||
"/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-mword-relocations",
|
||||
"-fomit-frame-pointer",
|
||||
"-ffast-math",
|
||||
"-fms-extensions",
|
||||
"-march=armv6k",
|
||||
"-mtune=mpcore",
|
||||
"-mfloat-abi=hard",
|
||||
"-I/home/user/3DSController/3DS/include",
|
||||
"-I/opt/devkitpro/libctru/include",
|
||||
"-I/home/user/3DSController/3DS/build",
|
||||
"-I/opt/devkitpro/devkitARM/arm-none-eabi/include/",
|
||||
"-D__3DS__",
|
||||
"-c",
|
||||
"-o",
|
||||
"drawing.o",
|
||||
"/home/user/3DSController/3DS/source/drawing.c"
|
||||
],
|
||||
"directory": "/home/user/3DSController/3DS/build",
|
||||
"file": "/home/user/3DSController/3DS/source/drawing.c",
|
||||
"output": "/home/user/3DSController/3DS/build/drawing.o"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
"/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-mword-relocations",
|
||||
"-fomit-frame-pointer",
|
||||
"-ffast-math",
|
||||
"-fms-extensions",
|
||||
"-march=armv6k",
|
||||
"-mtune=mpcore",
|
||||
"-mfloat-abi=hard",
|
||||
"-I/home/user/3DSController/3DS/include",
|
||||
"-I/opt/devkitpro/libctru/include",
|
||||
"-I/home/user/3DSController/3DS/build",
|
||||
"-D__3DS__",
|
||||
"-c",
|
||||
"-o",
|
||||
"inet_pton.o",
|
||||
"/home/user/3DSController/3DS/source/inet_pton.c"
|
||||
],
|
||||
"directory": "/home/user/3DSController/3DS/build",
|
||||
"file": "/home/user/3DSController/3DS/source/inet_pton.c",
|
||||
"output": "/home/user/3DSController/3DS/build/inet_pton.o"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
"/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-mword-relocations",
|
||||
"-fomit-frame-pointer",
|
||||
"-ffast-math",
|
||||
"-fms-extensions",
|
||||
"-march=armv6k",
|
||||
"-mtune=mpcore",
|
||||
"-mfloat-abi=hard",
|
||||
"-I/home/user/3DSController/3DS/include",
|
||||
"-I/opt/devkitpro/libctru/include",
|
||||
"-I/home/user/3DSController/3DS/build",
|
||||
"-D__3DS__",
|
||||
"-c",
|
||||
"-o",
|
||||
"input.o",
|
||||
"/home/user/3DSController/3DS/source/input.c"
|
||||
],
|
||||
"directory": "/home/user/3DSController/3DS/build",
|
||||
"file": "/home/user/3DSController/3DS/source/input.c",
|
||||
"output": "/home/user/3DSController/3DS/build/input.o"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
"/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-mword-relocations",
|
||||
"-fomit-frame-pointer",
|
||||
"-ffast-math",
|
||||
"-fms-extensions",
|
||||
"-march=armv6k",
|
||||
"-mtune=mpcore",
|
||||
"-mfloat-abi=hard",
|
||||
"-I/home/user/3DSController/3DS/include",
|
||||
"-I/opt/devkitpro/libctru/include",
|
||||
"-I/home/user/3DSController/3DS/build",
|
||||
"-D__3DS__",
|
||||
"-c",
|
||||
"-o",
|
||||
"keyboard.o",
|
||||
"/home/user/3DSController/3DS/source/keyboard.c"
|
||||
],
|
||||
"directory": "/home/user/3DSController/3DS/build",
|
||||
"file": "/home/user/3DSController/3DS/source/keyboard.c",
|
||||
"output": "/home/user/3DSController/3DS/build/keyboard.o"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
"/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-mword-relocations",
|
||||
"-fomit-frame-pointer",
|
||||
"-ffast-math",
|
||||
"-fms-extensions",
|
||||
"-march=armv6k",
|
||||
"-mtune=mpcore",
|
||||
"-mfloat-abi=hard",
|
||||
"-I/home/user/3DSController/3DS/include",
|
||||
"-I/opt/devkitpro/libctru/include",
|
||||
"-I/home/user/3DSController/3DS/build",
|
||||
"-I/opt/devkitpro/devkitARM/arm-none-eabi/include/",
|
||||
"-D__3DS__",
|
||||
"-c",
|
||||
"-o",
|
||||
"main.o",
|
||||
"/home/user/3DSController/3DS/source/main.c"
|
||||
],
|
||||
"directory": "/home/user/3DSController/3DS/build",
|
||||
"file": "/home/user/3DSController/3DS/source/main.c",
|
||||
"output": "/home/user/3DSController/3DS/build/main.o"
|
||||
}
|
||||
]
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "3ds/types.h"
|
||||
#ifndef REG_LCDBACKLIGHTMAIN
|
||||
#define REG_LCDBACKLIGHTMAIN (u32)(0x1ED02240 - 0x1EB00000)
|
||||
#endif
|
||||
|
@ -8,13 +9,13 @@
|
|||
#define REG_LCDBACKLIGHTSUB (u32)(0x1ED02A40 - 0x1EB00000)
|
||||
#endif
|
||||
|
||||
inline void clearScreen(void);
|
||||
void clearScreen(void);
|
||||
|
||||
#define drawPixelRGB(x, y, r, g, b) drawPixelRGBFramebuffer(0, x, y, r, g, b)
|
||||
void drawPixelRGBFramebuffer(u8 *fb, int x, int y, u8 r, u8 g, u8 b);
|
||||
|
||||
#define drawBox(x, y, width, height, r, g, b) drawBoxFramebuffer(0, x, y, width, height, r, g, b)
|
||||
inline void drawBoxFramebuffer(u8 *fb, int x, int y, int width, int height, u8 r, u8 g, u8 b);
|
||||
void drawBoxFramebuffer(u8 *fb, int x, int y, int width, int height, u8 r, u8 g, u8 b);
|
||||
|
||||
#define drawString(sx, sy, text, ...) drawStringFramebuffer(0, sx, sy, text, ##__VA_ARGS__)
|
||||
void drawStringFramebuffer(u8 *fb, int sx, int sy, char *text, ...);
|
||||
|
|
|
@ -8,4 +8,4 @@ extern unsigned char keyboardToggle;
|
|||
extern unsigned char keyboardGfx[320 * 240 * 3];
|
||||
|
||||
void preRenderKeyboard(void);
|
||||
inline void drawKeyboard(void);
|
||||
void drawKeyboard(void);
|
||||
|
|
|
@ -162,14 +162,14 @@ static u32 brightnessSub;
|
|||
void disableBacklight() {
|
||||
u32 off = 0;
|
||||
|
||||
GSPGPU_ReadHWRegs(NULL, REG_LCDBACKLIGHTMAIN, &brightnessMain, 4);
|
||||
GSPGPU_ReadHWRegs(NULL, REG_LCDBACKLIGHTSUB, &brightnessSub, 4);
|
||||
GSPGPU_ReadHWRegs(REG_LCDBACKLIGHTMAIN, &brightnessMain, 4);
|
||||
GSPGPU_ReadHWRegs(REG_LCDBACKLIGHTSUB, &brightnessSub, 4);
|
||||
|
||||
GSPGPU_WriteHWRegs(NULL, REG_LCDBACKLIGHTMAIN, &off, 4);
|
||||
GSPGPU_WriteHWRegs(NULL, REG_LCDBACKLIGHTSUB, &off, 4);
|
||||
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTMAIN, &off, 4);
|
||||
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &off, 4);
|
||||
}
|
||||
|
||||
void enableBacklight() {
|
||||
GSPGPU_WriteHWRegs(NULL, REG_LCDBACKLIGHTMAIN, &brightnessMain, 4);
|
||||
GSPGPU_WriteHWRegs(NULL, REG_LCDBACKLIGHTSUB, &brightnessSub, 4);
|
||||
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTMAIN, &brightnessMain, 4);
|
||||
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &brightnessSub, 4);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "3ds/services/soc.h"
|
||||
#include "wireless.h"
|
||||
#include "settings.h"
|
||||
#include "drawing.h"
|
||||
|
@ -39,7 +40,7 @@ int main(void) {
|
|||
|
||||
if(setjmp(exitJmp)) goto exit;
|
||||
|
||||
preRenderKeyboard();
|
||||
// preRenderKeyboard();
|
||||
|
||||
clearScreen();
|
||||
drawString(10, 10, "Initing FS...");
|
||||
|
@ -53,10 +54,10 @@ int main(void) {
|
|||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
SOC_Initialize((u32 *)memalign(0x1000, 0x100000), 0x100000);
|
||||
socInit((u32 *)memalign(0x1000, 0x100000), 0x100000);
|
||||
|
||||
u32 wifiStatus = 0;
|
||||
ACU_GetWifiStatus(NULL, &wifiStatus);
|
||||
ACU_GetWifiStatus(&wifiStatus);
|
||||
if(!wifiStatus) {
|
||||
hang("No WiFi! Is your wireless slider on?");
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ int main(void) {
|
|||
openSocket(settings.port);
|
||||
sendConnectionRequest();
|
||||
|
||||
clearScreen();
|
||||
// clearScreen();
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
|
@ -161,7 +162,7 @@ int main(void) {
|
|||
|
||||
enableBacklight();
|
||||
|
||||
SOC_Shutdown();
|
||||
socExit();
|
||||
|
||||
svcCloseHandle(fileHandle);
|
||||
fsExit();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "3ds/services/fs.h"
|
||||
#include "wireless.h"
|
||||
|
||||
#include "settings.h"
|
||||
|
@ -10,8 +11,8 @@
|
|||
struct settings settings;
|
||||
|
||||
struct settings defaultSettings = {
|
||||
IPString: "",
|
||||
port: DEFAULT_PORT,
|
||||
.IPString = "",
|
||||
.port= DEFAULT_PORT,
|
||||
};
|
||||
|
||||
Handle fileHandle;
|
||||
|
@ -40,10 +41,12 @@ bool readSettings(void) {
|
|||
u64 size;
|
||||
u32 bytesRead;
|
||||
|
||||
FS_archive sdmcArchive = (FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
|
||||
FS_path filePath = FS_makePath(PATH_CHAR, "/3DSController.ini");
|
||||
FS_ArchiveID sdmcArchiveID = (ARCHIVE_SDMC);
|
||||
// FS_Archive sdmcArchive = (FS_Archive){ARCHIVE_SDMC, (FS_Path){PATH_EMPTY, 1, (u8*)""}};
|
||||
FS_Path fileArchive = fsMakePath(PATH_EMPTY, NULL);
|
||||
FS_Path filePath = fsMakePath(PATH_ASCII, "/3DSController.ini");
|
||||
|
||||
Result ret = FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
|
||||
Result ret = FSUSER_OpenFileDirectly(&fileHandle, sdmcArchiveID, fileArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_HIDDEN);
|
||||
if(ret) return false;
|
||||
|
||||
ret = FSFILE_GetSize(fileHandle, &size);
|
||||
|
|
Loading…
Reference in a new issue