Skip to content

Commit

Permalink
Display IP address on top screen
Browse files Browse the repository at this point in the history
  • Loading branch information
System Administrator authored and System Administrator committed Mar 5, 2021
1 parent 6ea3684 commit 9be9eb8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 17 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.SUFFIXES:
#---------------------------------------------------------------------------------

DEVKITPRO=/opt/devkitpro
DEVKITARM=/opt/devkitpro/devkitARM

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# CTroll3D
Use 3DS as Citra gamepad

CTroll3D is a 3ds homebrew that allows you to control the Citra emulator on from your 3ds.
For this to work, you need a version of Citra that supports CTroll3D (for now, only my own fork of Citra) and the CTroll3D homebrew on your 3ds.

CTroll3D supports:

- DPAD
- CPAD
- Touch
- Accelerometer
- Gyroscope
- Bottom screen mirroring

One advice: glReadPixels and VSync doesn't doesn't perform too well. So, to increase the performance, please disable the VSync (and some other heavy stuffs like Accurate Multiplications). You can access these options in Preferences -> Graphics -> Advanced.

In some cases, the bottom screen mirroring can slow down your emulation, and should be disabled by pressing L + R + DOWN + click on Touch (and can be enabled by L + R + UP + click on Touch).

How to Use:

1 - Open the CTroll3D homebrew on your 3ds
2 - On Citra, access the menu option: Tools -> Connect CTroll3D and enter your 3DS IP Address
33 changes: 17 additions & 16 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ int main(int argc, char **argv) {

consoleInit(GFX_TOP, NULL);

printf ("\nCTroll3D\n");

// allocate buffer for SOC service
SOC_buffer = (u32*)memalign(SOC_ALIGN, SOC_BUFFERSIZE);

Expand All @@ -266,18 +264,23 @@ int main(int argc, char **argv) {

// Now intialise soc:u service
if ((ret = socInit(SOC_buffer, SOC_BUFFERSIZE)) != 0) {
failExit("socInit: 0x%08X\n", (unsigned int)ret);
failExit("socInit: 0x%08X\n", (unsigned int)ret);
}

// register socShutdown to run at exit
// atexit functions execute in reverse order so this runs before gfxExit
atexit(socShutdown);

gfxSetDoubleBuffering(GFX_BOTTOM, false);
u8* fb = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
gfxSetDoubleBuffering(GFX_BOTTOM, false);
u8* fb = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);

gspWaitForVBlank();
hidScanInput();

uint32_t ip = gethostid();
unsigned char *ipptr = (unsigned char *)&ip;
printf ("\nCTroll3D\nIP: %d.%d.%d.%d\n", ipptr[0], ipptr[1], ipptr[2], ipptr[3]);

gspWaitForVBlank();
hidScanInput();

HIDUSER_EnableAccelerometer();
HIDUSER_EnableGyroscope();
Expand All @@ -298,10 +301,10 @@ int main(int argc, char **argv) {
confirmationsDisabled = 0;
char b = 1;
send(sock, &b, 1, 0);
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();

if (header.rd < 2) {
header.rd = readData(sock, (char *)&header, 2, header.rd);
Expand All @@ -327,7 +330,7 @@ int main(int argc, char **argv) {
continue;
}
data.data = (char *) realloc(data.data, header.sz);
}
}

if (header.type == 0) {
}
Expand Down Expand Up @@ -356,8 +359,8 @@ int main(int argc, char **argv) {
}

read_JPEG_buf(data.data, header.sz, outputBuf);
unsigned char *dest = fb;
unsigned char *src = outputBuf;
unsigned char *dest = fb;
unsigned char *src = outputBuf;

int mapMask = 0x01;
int mapPos = 0;
Expand All @@ -378,11 +381,9 @@ int main(int argc, char **argv) {

header.rd = 0;
sendInputs(socketInputs);

}
close(socket);


return 0;
}

Expand Down

0 comments on commit 9be9eb8

Please sign in to comment.