Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Primitheus authored Jan 8, 2025
1 parent d1f7ec3 commit cc62f30
Show file tree
Hide file tree
Showing 8 changed files with 1,023 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
DIST_DIR := OctoLair
BIN_DIR := bin

UNAME_S := $(shell uname -s)

CFLAGS := ""
LDFLAGS := ""
CC := ""


ifeq ($(UNAME_S), Linux)
SYSROOT := /usr/local/aarch64-linux-gnu-7.5.0-linaro/sysroot
CFLAGS = -I${SYSROOT}/usr/include -I${SYSROOT}/usr/include/SDL2 -I/usr/include/aarch64-linux-gnu/curl -I ./include -D_REENTRANT
LDFLAGS = -L${SYSROOT}/lib -L${SYSROOT}/usr/lib -L/usr/lib/aarch64-linux-gnu/ -lSDL2_image -lSDL2_ttf -lSDL2 -ldl -lpthread -lm -lstdc++ -lxml2
CC = aarch64-linux-gnu-gcc --sysroot=${SYSROOT}
endif

SRC := src/main.cpp src/utils.cpp src/theme.cpp
OBJ := $(SRC:.cpp=.o)
TARGET := octolair

.PHONY: run build
.DEFAULT: build

build:
@mkdir -p ${BIN_DIR}
@${CC} ${CFLAGS} ${SRC} -o ${BIN_DIR}/${TARGET} ${LDFLAGS}

clean:
@rm -rf ${BIN_DIR}/* ${DIST_DIR}/*

run:
@${BIN_DIR}/${TARGET}
10 changes: 10 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef CONFIG_H
#define CONFIG_H

#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720




#endif
18 changes: 18 additions & 0 deletions include/theme.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef THEME_H
#define THEME_H

#include <SDL.h>

struct Theme {
SDL_Color backgroundColor;
SDL_Color textColor;
SDL_Color highlightColor;
SDL_Color borderColor;
SDL_Color progressBarColor;
};

extern Theme currentTheme;

void applyTheme(const Theme& theme);

#endif // THEME_H
29 changes: 29 additions & 0 deletions include/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef TYPES_H
#define TYPES_H

#include <string>
#include <unordered_map>

struct Game {
std::string title;
std::string region;
std::string version;
std::string languages;
std::string rating;
std::string url;
};

struct Console {
std::string name;
std::string url;
};

class Filter {
public:
std::string value;
Filter(const std::string& val) : value(val) {}
};



#endif // TYPES_H
28 changes: 28 additions & 0 deletions include/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef UTILS_H
#define UTILS_H

#include <string>
#include <vector>
#include <iostream>
#include <dlfcn.h>
#include <libxml/HTMLparser.h>
#include <libxml/xpath.h>
#include <regex>
#include <fstream>

#include "types.h"

size_t header_callback(void* ptr, size_t size, size_t nmemb, std::string* filename);
std::string getHtml(const std::string& url);
std::vector<Console> parseHTML(const std::string& html);
std::vector<Game> parseGamesHTML(const std::string &htmlContent);
int downloadGame(std::string console, const std::string &htmlContent);

#endif







Loading

0 comments on commit cc62f30

Please sign in to comment.