From 322ca17f5cbb4f1801d1af4c185546586a98f727 Mon Sep 17 00:00:00 2001 From: Tanner Babcock Date: Tue, 24 Sep 2019 20:55:29 -0500 Subject: [PATCH] File separation --- src/file.c | 6 +----- src/file.h | 19 +++++++++++++++++++ src/main.c | 2 +- src/main.h | 9 +-------- 4 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 src/file.h diff --git a/src/file.c b/src/file.c index fbd01a3..1e397c3 100644 --- a/src/file.c +++ b/src/file.c @@ -6,11 +6,7 @@ #include #include #include "main.h" - -typedef struct { - int year, month, day; - int minute, hour; -} metadata; +#include "file.h" void tmFileDialog(bool save) { int x; diff --git a/src/file.h b/src/file.h new file mode 100644 index 0000000..9225cb4 --- /dev/null +++ b/src/file.h @@ -0,0 +1,19 @@ +/* ToneMatrix - file.h + * Copyright (c) 2012 Tanner Babcock */ +#ifndef FILE_H +#define FILE_H + +#define bool char +#define MAX_SAVE_SLOTS 10 + +typedef struct { + int year, month, day; + int minute, hour; +} metadata; + +void tmFileDialog(bool save); +bool tmDoesFileExist(const char *path); +void tmRead(int slot); +void tmWrite(int slot); + +#endif diff --git a/src/main.c b/src/main.c index 19321db..5a34074 100644 --- a/src/main.c +++ b/src/main.c @@ -12,7 +12,7 @@ PSP_HEAP_SIZE_KB(2048); void tmMainLoop(void) { int x = 0, y = 0, q, m; - int tmpcurrent = current; + unsigned char tmpcurrent = current; clock_t start, cu; start = sceKernelLibcClock(); oslClearScreen(RGBA(0, 0, 0, 255)); diff --git a/src/main.h b/src/main.h index ce9cac9..ad57a57 100644 --- a/src/main.h +++ b/src/main.h @@ -27,8 +27,7 @@ enum { MAX_X = 16, MAX_Y = 8, MAX_BPM = 250, - MIN_BPM = 60, - MAX_SAVE_SLOTS = 10 + MIN_BPM = 60 }; typedef struct { @@ -51,12 +50,6 @@ OSL_IMAGE *select; int tmGetColor(char gridval, int x, int y); void tmDrawGrid(void); -// file.c -void tmFileDialog(bool save); -bool tmDoesFileExist(const char *path); -void tmRead(int slot); -void tmWrite(int slot); - // grid.c void tmClear(tmGrid *g); bool tmIsGridEmpty(tmGrid *g);