convert chars to signed/unsigned

This commit is contained in:
tildearrow 2021-05-11 15:26:38 -05:00
parent 783d56c72a
commit 8c014802c9
8 changed files with 15 additions and 15 deletions

View file

@ -35,7 +35,7 @@ set(ENGINE_SOURCES src/log.cpp src/engine/safeReader.cpp src/engine/engine.cpp)
add_executable(divorce ${ENGINE_SOURCES} ${AUDIO_SOURCES} add_executable(divorce ${ENGINE_SOURCES} ${AUDIO_SOURCES}
src/main.cpp) src/main.cpp)
target_link_libraries(divorce ${HAVE_SDL2} z GL GLEW) target_link_libraries(divorce ${HAVE_SDL2} z)
if (HAVE_JACK) if (HAVE_JACK)
target_link_libraries(divorce ${HAVE_JACK}) target_link_libraries(divorce ${HAVE_JACK})

View file

@ -192,7 +192,7 @@ bool DivEngine::load(void* f, size_t slen) {
} }
ds.version=reader.readC(); ds.version=reader.readC();
logI("module version %d (0x%.2x)\n",ds.version,ds.version); logI("module version %d (0x%.2x)\n",ds.version,ds.version);
char sys=0; unsigned char sys=0;
if (ds.version<0x09) { if (ds.version<0x09) {
// V E R S I O N -> 3 <- // V E R S I O N -> 3 <-
// AWESOME // AWESOME

View file

@ -6,10 +6,10 @@ enum DivInstrumentType {
}; };
struct DivInstrumentFM { struct DivInstrumentFM {
char alg, fb, fms, ams, ops; unsigned char alg, fb, fms, ams, ops;
struct { struct {
char am, ar, dr, mult, rr, sl, tl, dt2, rs, dt, d2r, ssgEnv; unsigned char am, ar, dr, mult, rr, sl, tl, dt2, rs, dt, d2r, ssgEnv;
char dam, dvb, egt, ksl, sus, vib, ws, ksr; // YMU759 unsigned char dam, dvb, egt, ksl, sus, vib, ws, ksr; // YMU759
} op[4]; } op[4];
}; };

View file

@ -1,3 +1,3 @@
struct DivOrders { struct DivOrders {
char ord[32][128]; unsigned char ord[32][128];
}; };

View file

@ -1,9 +1,9 @@
struct DivPattern { struct DivPattern {
char data[256][16]; unsigned char data[256][16];
}; };
struct DivChannelData { struct DivChannelData {
char effectRows; unsigned char effectRows;
// data goes as follows: data[ROW][TYPE] // data goes as follows: data[ROW][TYPE]
// TYPE is: // TYPE is:
// 0: note // 0: note
@ -12,4 +12,4 @@ struct DivChannelData {
// 3: volume // 3: volume
// 4-5+: effect/effect value // 4-5+: effect/effect value
std::vector<DivPattern*> data; std::vector<DivPattern*> data;
}; };

View file

@ -47,7 +47,7 @@ int SafeReader::read(void* where, size_t count) {
return count; return count;
} }
char SafeReader::readC() { signed char SafeReader::readC() {
#ifdef READ_DEBUG #ifdef READ_DEBUG
logD("SR: reading char %x:\n",curSeek); logD("SR: reading char %x:\n",curSeek);
#endif #endif
@ -126,7 +126,7 @@ String SafeReader::readString(size_t stlen) {
#endif #endif
size_t curPos=0; size_t curPos=0;
while (curPos<stlen) { while (curPos<stlen) {
char c=readC(); unsigned char c=readC();
if (c!=0) ret.push_back(c); if (c!=0) ret.push_back(c);
curPos++; curPos++;
} }
@ -135,7 +135,7 @@ String SafeReader::readString(size_t stlen) {
String SafeReader::readString() { String SafeReader::readString() {
String ret; String ret;
char c; unsigned char c;
while ((c=readC())!=0) { while ((c=readC())!=0) {
ret.push_back(c); ret.push_back(c);
} }

View file

@ -28,7 +28,7 @@ class SafeReader {
int read(void* where, size_t count); int read(void* where, size_t count);
// these functions may throw EndOfFileException. // these functions may throw EndOfFileException.
char readC(); signed char readC();
short readS(); short readS();
short readS_BE(); short readS_BE();
int readI(); int readI();

View file

@ -1,7 +1,7 @@
struct DivSample { struct DivSample {
String name; String name;
int length, rate; int length, rate;
char vol, pitch, depth; signed char vol, pitch;
unsigned char depth;
short* data; short* data;
char* data8;
}; };