Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build/
libreshop-client.*
*.dol
*.elf # probably better for forks
libreshop/boot.dol
libreshop/config.json
libreshop.zip
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lwiiuse -lbte -lfat -logc -lm -lzip -lz -lbz2 -ljansson -lwinyl -lyuarel
LIBS := -lwiiuse -lmad -lasnd -lbte -lfat -logc -lm -lzip -lz -lbz2 -ljansson -lwinyl -lyuarel

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
Expand Down Expand Up @@ -131,6 +131,15 @@ $(OFILES_SOURCES) : $(HFILES)
@echo $(notdir $<)
$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .json extension
#---------------------------------------------------------------------------------
%.mp3.o %_mp3.h : %.mp3
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)


-include $(DEPENDS)

#---------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ Wii Homebrew downloader. Powered by Open Shop Channel
### Build instructions
Before building, install these dependencies:
```
pacman -S ppc-zip ppc-jansson wii-winyl ppc-yuarel
pacman -S ppc-zip ppc-jansson wii-winyl ppc-yuarel libmad --needed
```
You will need to add the [nez-wii](https://wii.nezbednik.eu.org) pacman repository.


```
./data/create_acknowledgements
make
Expand Down
2 changes: 1 addition & 1 deletion data/create_acknowledgements
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ EOF

# wrap it for the Wii
echo -n > acknowledgements.json
echo "acknowledgements.json"
echo "acknowledgements.json" # and i can assure you, that is not a json file.
echo "+-----------------------------------------------------------------------------+"
while IFS= read -r p; do
printf "|%-77s|\n" "${p}"
Expand Down
Binary file added data/loop.mp3
Binary file not shown.
Binary file removed libreshop/icon.png
Binary file not shown.
21 changes: 0 additions & 21 deletions libreshop/meta.xml

This file was deleted.

31 changes: 30 additions & 1 deletion source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@
#include <winyl/winyl.h>
#include <winyl/request.h>
#include <winyl/version.h>
#include <asndlib.h>
#include <mp3player.h>
//can we also include my will to live
#include <ogc/lwp.h>
#include <unistd.h>
#include <winyl/header.h>


#include "loop_mp3.h" // when i feel like it i might make repos be able to have their own music
#include "debug.h"
#include "config.h"
#include "tui.h"

#include "default_config_json.h"
static bool loading = true; // what is the point of this
static lwp_t background_thread = LWP_THREAD_NULL; // uh..sure past me?

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;
Expand Down Expand Up @@ -49,7 +58,22 @@ void logprint(int type, char *message) {
}
printf(" \x1b[37m%s", message);
}

static void* loop_sound(void* arg) {
// i hate this code
while (1) {
if (loading) {
if (!MP3Player_IsPlaying()) {
MP3Player_PlayBuffer(loop_mp3, loop_mp3_size, NULL);
}
} else {
if (MP3Player_IsPlaying()) {
MP3Player_Stop();
}
}
usleep(10 * 1000); // make the cpu not commit suicide
}
return NULL;
}
void home_exit(int message) {
if (message) logprint(0, "Press HOME (Start) to exit\n");

Expand Down Expand Up @@ -77,6 +101,8 @@ int main(int argc, char **argv) {

WPAD_Init();
PAD_Init();
ASND_Init();
MP3Player_Init();

rmode = VIDEO_GetPreferredMode(NULL);

Expand All @@ -99,13 +125,16 @@ int main(int argc, char **argv) {

printheader();
logprint(0, "Welcome to LibreShop!\n");

LWP_CreateThread(&background_thread,loop_sound,NULL,NULL,0,80); //create the thread so music actually plays
#ifdef DEBUG
logprint(2, "Warning! You are running a DEBUG build.\n");
#endif

printf("\n");
logprint(0, "Initializing network.\n");


ret = if_config(localip, netmask, gateway, TRUE, 20);

if (ret >= 0) {
Expand Down
23 changes: 23 additions & 0 deletions source/mp3player.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef __MP3PLAYER_H__
#define __MP3PLAYER_H__

#include <mad.h>
#include <gctypes.h>
#include <ogc/mp3player.c> // try actually including the mp3player wintermute

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

void MP3Player_Init(void);
void MP3Player_Stop(void);
bool MP3Player_IsPlaying(void);
void MP3Player_Volume(u32 volume);
s32 MP3Player_PlayBuffer(const void *buffer,s32 len,void (*filterfunc)(struct mad_stream *,struct mad_frame *));
s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*filterfunc)(struct mad_stream *,struct mad_frame *));

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif