Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app to sort emulators in Games menu #1460

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ src/**/axp
!axp/
src/**/batteryMonitorUI
!batteryMonitorUI/
src/**/emusort
!emuSort/
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ apps: $(CACHE)/.setup
@find $(SRC_DIR)/packageManager -depth -type d -name res -exec cp -r {}/. $(BUILD_DIR)/App/PackageManager/res/ \;
@cd $(SRC_DIR)/clock && BUILD_DIR="$(BIN_DIR)" make
@cd $(SRC_DIR)/randomGamePicker && BUILD_DIR="$(BIN_DIR)" make
@cd $(SRC_DIR)/emuSort && BUILD_DIR="$(PACKAGES_APP_DEST)/MainUI Emulator Sorter/App/EmuSort" make
# Preinstalled apps
@cp -a "$(PACKAGES_APP_DEST)/Activity Tracker/." $(BUILD_DIR)/
@cp -a "$(PACKAGES_APP_DEST)/Quick Guide/." $(BUILD_DIR)/
Expand Down
43 changes: 43 additions & 0 deletions src/common/utils/timer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef TIMER_H__
#define TIMER_H__

#include <stdio.h>
#include <sys/time.h>

#ifdef LOG_DEBUG

#define START_TIMER(struct_name) \
struct timeval struct_name##_before, struct_name##_after, struct_name##_result; \
gettimeofday(&struct_name##_before, NULL);

#define END_TIMER(struct_name) \
gettimeofday(&struct_name##_after, NULL); \
timersub(&struct_name##_after, &struct_name##_before, &struct_name##_result); \
long struct_name##_milliseconds = struct_name##_result.tv_sec * 1000 + struct_name##_result.tv_usec / 1000; \
printf("\033[1;33m%s: %ld milliseconds\033[0m\n", #struct_name, struct_name##_milliseconds);

#else

#define START_TIMER(struct_name)
#define END_TIMER(struct_name)

#endif

#endif

/*
* Usage:
*
* #include "timer.h"
*
* int main() {
* START_TIMER(loading);
* some_loading_function();
* END_TIMER(loading);
* return 0;
* }
*
* Output:
*
* loading: 123 milliseconds
*/
10 changes: 10 additions & 0 deletions src/emuSort/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INCLUDE_CJSON=1

include ../common/config.mk

TARGET = emusort
LDFLAGS := $(LDFLAGS) -lSDL -lSDL_ttf -lSDL_image -lSDL_mixer -lSDL_rotozoom -lsqlite3
CFLAGS := $(CFLAGS)

include ../common/commands.mk
include ../common/recipes.mk
Loading
Loading