blues/intern.h

69 lines
1.3 KiB
C
Raw Normal View History

2018-07-08 16:08:53 +02:00
#ifndef INTERN_H__
#define INTERN_H__
#include <assert.h>
2019-05-29 01:54:47 +02:00
#include <limits.h>
2018-07-08 16:08:53 +02:00
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
2018-12-16 13:34:03 +01:00
#define SWAP(x, y) do { typeof(x) tmp = x; x = y; y = tmp; } while(0)
2018-07-08 16:08:53 +02:00
2018-12-16 13:34:03 +01:00
#undef MIN
static inline int MIN(int a, int b) {
return (a < b) ? a : b;
}
#undef MAX
static inline int MAX(int a, int b) {
return (a > b) ? a : b;
2018-07-08 16:08:53 +02:00
}
static inline uint32_t READ_BE_UINT32(const uint8_t *p) {
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
2018-12-16 13:34:03 +01:00
static inline uint16_t READ_BE_UINT16(const uint8_t *p) {
return (p[0] << 8) | p[1];
}
2018-07-08 16:08:53 +02:00
static inline uint16_t READ_LE_UINT16(const uint8_t *p) {
return p[0] | (p[1] << 8);
}
2018-12-16 13:34:03 +01:00
static inline void WRITE_LE_UINT16(uint8_t *p, uint16_t value) {
p[0] = value & 0xFF;
p[1] = value >> 8;
}
#define GAME_SCREEN_W g_options.screen_w
#define GAME_SCREEN_H g_options.screen_h
struct options_t {
uint32_t cheats;
int start_level;
int start_xpos16;
int start_ypos16;
int screen_w;
int screen_h;
// 'bb' only options
bool amiga_copper_bars;
bool amiga_colors;
bool amiga_status_bar;
bool dos_scrolling;
bool cga_colors;
2022-02-25 20:12:38 +01:00
bool hybrid_color;
2018-12-16 13:34:03 +01:00
};
struct game_t {
const char *name;
//int (*detect)(const char *data_path);
void (*run)(const char *data_path);
};
2018-07-08 16:08:53 +02:00
#endif