Skip to content

Commit

Permalink
v0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Komas19-new committed May 27, 2023
1 parent 7ada40f commit f849629
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 53 deletions.
2 changes: 1 addition & 1 deletion 3DSLINKTEST.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3dslink\3dslink.exe Compiled\flappy.3dsx -a 192.168.1.19
3dslink\3dslink.exe Compiled\flappy3ds.3dsx -a 192.168.1.19
PAUSE
Binary file removed Compiled/flappy.elf
Binary file not shown.
Binary file renamed Compiled/flappy.3dsx → Compiled/flappy3ds.3dsx
Binary file not shown.
Binary file renamed Compiled/flappy.cia → Compiled/flappy3ds.cia
Binary file not shown.
Binary file added Compiled/flappy3ds.elf
Binary file not shown.
4 changes: 2 additions & 2 deletions cia_workaround.rsf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BasicInfo:
Title : "Flappy3DS"
ProductCode : "CTR-FLAPPY"
ProductCode : "CTR-FLAPPY-3DS"
ContentType : Application
Logo : Homebrew # Nintendo / Licensed / Distributed / iQue / iQueForSystem

Expand Down Expand Up @@ -67,7 +67,7 @@ AccessControlInfo:
HandleTableSize: 512

SystemModeExt : Legacy # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
CpuSpeed : 804MHz # 268MHz(Default)/804MHz
CpuSpeed : 268MHz # 268MHz(Default)/804MHz
EnableL2Cache : true # false(default)/true
CanAccessCore2 : true

Expand Down
12 changes: 7 additions & 5 deletions gw_workaround.rsf
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
BasicInfo:
Title : "Flappy3DS"
CompanyCode : "00"
ProductCode : "CTR-FLAPPY"
ProductCode : "CTR-FLAPPY-3DS"
ContentType : Application
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
Logo : Homebrew # Nintendo / Licensed / Distributed / iQue / iQueForSystem

RomFs:
RootPath: "../romfs"

TitleInfo:
UniqueId : 0xf1a66
UniqueId : 0x1337
Category : Application

CardInfo:
Expand Down Expand Up @@ -45,7 +47,7 @@ AccessControlInfo:

SystemControlInfo:
SaveDataSize: 128KB
RemasterVersion: 0
RemasterVersion: 1
StackSize: 0x40000

# DO NOT EDIT BELOW HERE OR PROGRAMS WILL NOT LAUNCH (most likely)
Expand Down
Binary file modified icon.bin
Binary file not shown.
8 changes: 5 additions & 3 deletions make 3ds and cia.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
3dstool -cvtf romfs romfs.bin --romfs-dir romfs
makerom -f cci -o flappy.3ds -rsf gw_workaround.rsf -target d -exefslogo -elf flappy.elf -icon icon.bin -romfs romfs.bin
makerom -f cia -o flappy.cia -elf flappy.elf -rsf cia_workaround.rsf -icon icon.bin -exefslogo -target t -romfs romfs.bin
move flappy.cia Compiled/
move flappy.elf Compiled/
move flappy.3dsx Compiled/
rename flappy.cia flappy3ds.cia
rename flappy.elf flappy3ds.elf
move flappy3ds.cia Compiled/
move flappy3ds.elf Compiled/
move flappy3ds.3dsx Compiled/
pause
3 changes: 2 additions & 1 deletion make 3dsx.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
make
move flappy.3dsx Compiled/
rename flappy.3dsx flappy3ds.3dsx
move flappy3ds.3dsx Compiled/
pause
88 changes: 48 additions & 40 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <dirent.h>

const char* versionNumber = "Beta 0.1.8";
#ifndef NULL
#define NULL ((void *) 0) //to get rid of Eclipse's NULL errors
#endif
Expand All @@ -19,17 +19,45 @@
#define DEFvelChange 1
#define DEFspeed 2
#define hideBreakingGame false
#define ver "Main Branch - Beta 0.1.7"

s32 i;
s32 j;
touchPosition tPos;
s16 vel;
u8 altitude;
u16 score;
u16 highscore;
// u8 dieOnGround;
// u8 defaultDieOnGround;
u16 deaths;
s16 oldPos;
s16 scoreSpot;
u8 isHighscored;
u8 floorHeight;
u16 flappyX;
u8 pipeCount;
u16 spaceHorizontal;
u8 pipeSpace;
u8 pipeWidth;
u8 flappyPixelSize;
s8 power;
s8 velDivider;
s8 velChange;
s8 speed;
u8 isDefaultSettings;
u8 printed;
u8 counter;

// defaultDieOnGround = 0; // 1 = enabled, 0 = disabled
// dieOnGround = 0; // 1 = enabled, 0 = disabled

void loadHighScore() {

mkdir("/Flappy3DS", 0777);

FILE *file = fopen("Flappy3DS/highscore.bin", "rb");
if (file == NULL) {
FILE *file2 fopen("Flappy3DS/highscore.bin", "wb");
highscore = 0;
fwrite(&highscore, 2, 1, file2);
return;
}
fread(&highscore, 1, 2, file);
Expand All @@ -42,9 +70,7 @@ void loadDeaths() {

FILE *file = fopen("Flappy3DS/deaths.bin", "rb");
if (file == NULL) {
FILE *file2 fopen("Flappy3DS/deaths.bin", "wb");
deaths = 0;
fwrite(&deaths, 2, 1, file2);
return;
}
fread(&deaths, 1, 2, file);
Expand Down Expand Up @@ -85,31 +111,6 @@ enum gameState {
RUNNING, GAMEOVER, MAIN, OPTIONS, COLLISIONOFF, AI_MOVEMENT
} gState;

s32 i;
s32 j;
touchPosition tPos;
s16 vel;
u8 altitude;
u16 score;
u16 highscore;
u16 deaths;
s16 oldPos;
s16 scoreSpot;
u8 isHighscored;
u8 floorHeight;
u16 flappyX;
u8 pipeCount;
u16 spaceHorizontal;
u8 pipeSpace;
u8 pipeWidth;
u8 flappyPixelSize;
s8 power;
s8 velDivider;
s8 velChange;
s8 speed;
u8 isDefaultSettings;
u8 printed;
u8 counter;

void clrScreen(u8 *fb) {
memset(fb, 0, 240 * 400 * 3);
Expand Down Expand Up @@ -161,6 +162,7 @@ void resetOptions() {
velDivider = DEFvelDivider;
velChange = DEFvelChange;
speed = DEFspeed;
// dieOnGround = defaultDieOnGround;

isDefaultSettings = 1;
}
Expand Down Expand Up @@ -218,7 +220,7 @@ int main() {

hidTouchRead(&tPos);

/***** Game Mechanichs *****/
/***** Game Mechanics *****/

u32 kDown = hidKeysDown();
if (kDown & KEY_START)
Expand Down Expand Up @@ -475,8 +477,15 @@ int main() {
vel -= velChange;
// if (vel <= -18)
// vel = -18;

if (altitude < floorHeight + flappyPixelSize) {
gState = GAMEOVER;
printed = 0;
}

if (kDown & KEY_SELECT) {
gState = GAMEOVER;
printed = 0;
if (score > highscore && isDefaultSettings == 1) {
isHighscored = 1;
highscore = score;
Expand Down Expand Up @@ -697,11 +706,8 @@ int main() {
}
counter++;
} else if (tPos.py <= 196) {
if (flappyX < 400) {
flappyX++;
isDefaultSettings = 0;
}
counter++;
isDefaultSettings = 0;
// dieOnGround = !dieOnGround;
}
printed = 0;
}
Expand Down Expand Up @@ -803,7 +809,7 @@ int main() {
// printf("\033[16;5fPress L to start with AI movement");
printf("\033[18;15fHighscore");
printf("\033[20;18f%d", highscore);
printf("\033[0;0fVer. %s", ver);
printf("\033[0;0fVer. %s", versionNumber);
if (hideBreakingGame == false) {
printf("\033[28;6fTap here to break the game");
}
Expand All @@ -815,7 +821,7 @@ int main() {
} else if (gState == RUNNING) {
printf("\033[8;16fScore");
printf("\033[10;18f%d", score);
printf("\033[0;0fFlappy3DS %s", ver);
printf("\033[0;0fFlappy3DS %s", versionNumber);
} else if (gState == GAMEOVER) {
printf("\033[6;14fGAME OVER");
printf("\033[9;16fScore");
Expand All @@ -839,7 +845,7 @@ int main() {
i = 0;
while (i < 10) {
printf("\033[%d;16f-", i * 2 + 5);
printf("\033[%d;22f+", i * 2 + 5);
// printf("\033[%d;22f+", i * 2 + 5);
i++;
}
printf("\033[5;0fFlappy Size");
Expand All @@ -851,6 +857,7 @@ int main() {
printf("\033[17;0fVel. Divider");
printf("\033[19;0fGravity");
printf("\033[21;0fSpeed");
// printf("\033[23;0fDie on ground");

printf("\033[5;18f%d", flappyPixelSize);
printf("\033[7;18f%d", pipeWidth);
Expand All @@ -861,6 +868,7 @@ int main() {
printf("\033[17;18f%d", velDivider);
printf("\033[19;18f%d", velChange);
printf("\033[21;18f%d", speed);
// printf("\033[23;18f%s", dieOnGround ? "Enabled" : "Disabled"); // Display current ground collision state
}
printed = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion strip elf.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
arm-none-eabi-strip flappypixel.elf
arm-none-eabi-strip Compiled/flappy3ds.elf
pause

0 comments on commit f849629

Please sign in to comment.