Skip to content

Commit cc62f30

Browse files
authored
Add files via upload
1 parent d1f7ec3 commit cc62f30

8 files changed

Lines changed: 1023 additions & 0 deletions

File tree

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
DIST_DIR := OctoLair
2+
BIN_DIR := bin
3+
4+
UNAME_S := $(shell uname -s)
5+
6+
CFLAGS := ""
7+
LDFLAGS := ""
8+
CC := ""
9+
10+
11+
ifeq ($(UNAME_S), Linux)
12+
SYSROOT := /usr/local/aarch64-linux-gnu-7.5.0-linaro/sysroot
13+
CFLAGS = -I${SYSROOT}/usr/include -I${SYSROOT}/usr/include/SDL2 -I/usr/include/aarch64-linux-gnu/curl -I ./include -D_REENTRANT
14+
LDFLAGS = -L${SYSROOT}/lib -L${SYSROOT}/usr/lib -L/usr/lib/aarch64-linux-gnu/ -lSDL2_image -lSDL2_ttf -lSDL2 -ldl -lpthread -lm -lstdc++ -lxml2
15+
CC = aarch64-linux-gnu-gcc --sysroot=${SYSROOT}
16+
endif
17+
18+
SRC := src/main.cpp src/utils.cpp src/theme.cpp
19+
OBJ := $(SRC:.cpp=.o)
20+
TARGET := octolair
21+
22+
.PHONY: run build
23+
.DEFAULT: build
24+
25+
build:
26+
@mkdir -p ${BIN_DIR}
27+
@${CC} ${CFLAGS} ${SRC} -o ${BIN_DIR}/${TARGET} ${LDFLAGS}
28+
29+
clean:
30+
@rm -rf ${BIN_DIR}/* ${DIST_DIR}/*
31+
32+
run:
33+
@${BIN_DIR}/${TARGET}

include/config.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef CONFIG_H
2+
#define CONFIG_H
3+
4+
#define SCREEN_WIDTH 1280
5+
#define SCREEN_HEIGHT 720
6+
7+
8+
9+
10+
#endif

include/theme.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef THEME_H
2+
#define THEME_H
3+
4+
#include <SDL.h>
5+
6+
struct Theme {
7+
SDL_Color backgroundColor;
8+
SDL_Color textColor;
9+
SDL_Color highlightColor;
10+
SDL_Color borderColor;
11+
SDL_Color progressBarColor;
12+
};
13+
14+
extern Theme currentTheme;
15+
16+
void applyTheme(const Theme& theme);
17+
18+
#endif // THEME_H

include/types.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef TYPES_H
2+
#define TYPES_H
3+
4+
#include <string>
5+
#include <unordered_map>
6+
7+
struct Game {
8+
std::string title;
9+
std::string region;
10+
std::string version;
11+
std::string languages;
12+
std::string rating;
13+
std::string url;
14+
};
15+
16+
struct Console {
17+
std::string name;
18+
std::string url;
19+
};
20+
21+
class Filter {
22+
public:
23+
std::string value;
24+
Filter(const std::string& val) : value(val) {}
25+
};
26+
27+
28+
29+
#endif // TYPES_H

include/utils.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef UTILS_H
2+
#define UTILS_H
3+
4+
#include <string>
5+
#include <vector>
6+
#include <iostream>
7+
#include <dlfcn.h>
8+
#include <libxml/HTMLparser.h>
9+
#include <libxml/xpath.h>
10+
#include <regex>
11+
#include <fstream>
12+
13+
#include "types.h"
14+
15+
size_t header_callback(void* ptr, size_t size, size_t nmemb, std::string* filename);
16+
std::string getHtml(const std::string& url);
17+
std::vector<Console> parseHTML(const std::string& html);
18+
std::vector<Game> parseGamesHTML(const std::string &htmlContent);
19+
int downloadGame(std::string console, const std::string &htmlContent);
20+
21+
#endif
22+
23+
24+
25+
26+
27+
28+

0 commit comments

Comments
 (0)