2 * RGB2R-C128-Kassenprogramm
3 * (c) 2007 phil_fry, sECuRE, sur5r
4 * See LICENSE for license information
20 /* undocumented function which scratches files */
21 //unsigned char __fastcall__ _sysremove(const char *name);
23 unsigned long int money = 0;
24 unsigned long int items_sold = 0;
25 BYTE printer_port = 4;
26 static bool items_exists = false;
27 static bool credits_exists = false;
28 struct status_array_t status;
29 struct credits_array_t credits;
32 * Checks if items/credits-files are existing to avoid having to recover
33 * the error state of the drive (we'd have to if we would just access the
37 static void lookup_needed_files() {
39 struct cbm_dirent *dirent;
41 if (cbm_opendir(lfn, (BYTE)8) != 0) {
42 cprintf("could not open directory\r\n");
45 while (cbm_readdir(lfn, dirent) == 0) {
46 if (strncmp(dirent->name, "log", 3) == 0)
48 if (strcasecmp(dirent->name, "items") == 0)
50 if (strcasecmp(dirent->name, "credits") == 0)
51 credits_exists = true;
58 cbm_load("items", (BYTE)8, &status);
60 memset(&status, 0, sizeof(struct status_array_t));
65 cbm_load("credits", (BYTE)8, &credits);
67 memset(&credits, 0, sizeof(struct credits_array_t));
73 cbm_save("items", (BYTE)8, &status, sizeof(struct status_array_t));
80 cbm_save("credits", (BYTE)8, &credits, sizeof(struct credits_array_t));
81 credits_exists = true;
85 lookup_needed_files();