Changeset 0edef06 in buchla-emu


Ignore:
Timestamp:
08/06/2017 08:20:22 AM (2 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
3523847
Parents:
59ea67d
Message:

Configurable font file.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r59ea67d r0edef06  
    44midas.elf
    55
     6build/*
    67buchla
    78buchla.exe
  • emu/all.h

    r59ea67d r0edef06  
    6363extern const char *bios;
    6464extern const char *disk;
     65extern const char *font;
    6566
    6667extern SDL_atomic_t run;
  • emu/main.c

    r59ea67d r0edef06  
    4141const char *bios = "bios.abs";
    4242const char *disk = "buchla.disk";
     43const char *font = "ttf/vera-sans-mono.ttf";
    4344
    4445SDL_atomic_t run;
     
    4647static void usage(FILE *fh)
    4748{
    48         fprintf(fh, "usage: buchla [-h] [-v comp [-v comp [...]]] [-b bios] [-d disk]\n");
     49        fprintf(fh, "usage: buchla [-h] [-v comp [-v comp [...]]] [-b bios] [-d disk] [-f font]\n");
    4950        fprintf(fh, "where comp is one of: ");
    5051
     
    8384
    8485                        disk = argv[i];
     86                        continue;
     87                }
     88
     89                if (strcmp(argv[i], "-f") == 0) {
     90                        if (++i == argc) {
     91                                usage(stderr);
     92                                fprintf(stderr, "missing argument to -f\n");
     93                                exit(1);
     94                        }
     95
     96                        font = argv[i];
    8597                        continue;
    8698                }
  • emu/ser.c

    r59ea67d r0edef06  
    3737#define CON_FGR ((SDL_Color){ .r = 255, .b = 255, .g = 255, .a = 255 })
    3838
    39 #define CON_FONT "ttf/vera-sans-mono.ttf"
    40 
    4139#define REG_IER_ISR 0
    4240#define REG_CFR_SR  1
     
    287285        SDL_AtomicSet(&frame, 1);
    288286
    289         SDL_RWops *ops = SDL_RWFromFile(CON_FONT, "rb");
     287        SDL_RWops *ops = SDL_RWFromFile(font, "rb");
    290288
    291289        if (ops == NULL) {
    292                 fail("error while opening font file " CON_FONT ": %s", SDL_GetError());
     290                fail("error while opening font file %s: %s", font, SDL_GetError());
    293291        }
    294292
     
    296294
    297295        if (fon == NULL) {
    298                 fail("error while loading font file " CON_FONT ": %s", TTF_GetError());
     296                fail("error while loading font file %s: %s", font, TTF_GetError());
    299297        }
    300298
Note: See TracChangeset for help on using the changeset viewer.