Skip to content

Commit

Permalink
-several sound mixer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SiENcE committed Sep 26, 2010
1 parent 41be91f commit d019ee8
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 45 deletions.
8 changes: 5 additions & 3 deletions Makefile_cygwin.caanoo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
UNZIP=1
#GLIDE=1
#OPENGL=1
THREAD_SOUND=1
#THREAD_SOUND=1
CHEATS=1
#ASMKREED=1
#ZSNESC4=1
Expand Down Expand Up @@ -119,8 +119,10 @@ STRIP := ${BINPATH}/$(ARCH)-strip
AS := ${BINPATH}/$(ARCH)-as
GASM := ${BINPATH}/$(ARCH)-g++

OPTIMISE = -mcpu=arm926ej-s -mtune=arm926ej-s -g -I. -I$(TOOLCHAINDIR)/$(ARCH)/include -O3 -D_ZAURUS -DCAANOO -DUSE_SA1
OPTIMISE += -ffast-math -fexpensive-optimizations -finline -finline-functions -falign-functions=32 -falign-loops -falign-labels -falign-jumps -fomit-frame-pointer
OPTIMISE = -mcpu=arm926ej-s -mtune=arm926ej-s -I. -I$(TOOLCHAINDIR)/$(ARCH)/include -O3 -D_ZAURUS -DCAANOO -DUSE_SA1
OPTIMISE += -ffast-math -fexpensive-optimizations -finline -finline-functions -falign-functions=32 -falign-loops -falign-labels -falign-jumps -fomit-frame-pointer -fprofile-use
#-fprofile-generate
#-fprofile-use

CCFLAGS = $(OPTIMISE) \
-I. \
Expand Down
6 changes: 4 additions & 2 deletions Makefile_cygwin.dingoo
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ STRIP := $(BINPATH)/mipsel-linux-uclibc-strip
AS := $(BINPATH)/mipsel-linux-uclibc-as
GASM := $(BINPATH)/mipsel-linux-uclibc-g++

OPTIMISE= -D_ZAURUS -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions -G 0 -march=mips32 -mtune=r4600 -mno-mips16 -msoft-float
# -fprofile-use -ftest-coverage -fprofile-arcs
OPTIMISE= -D_ZAURUS -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions -G 0 -march=mips32 -mno-mips16 -msoft-float
#-fprofile-generate
#-fprofile-use
#-mtune=r4600 -ftest-coverage

CCFLAGS = $(OPTIMISE) \
-I. \
Expand Down
3 changes: 1 addition & 2 deletions soundux.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ void S9xSetEchoDelay (int byte);
void S9xSetEchoWriteEnable (uint8 byte);
void S9xSetFilterCoefficient (int tap, int value);
void S9xSetFrequencyModulationEnable (uint8 byte);
void S9xSetEnvelopeRate (int channel, unsigned long rate, int direction,
int target);
void S9xSetEnvelopeRate (int channel, unsigned long rate, int direction, int target);
bool8_32 S9xSetSoundMode (int channel, int mode);
int S9xGetEnvelopeHeight (int channel);
void S9xResetSound (bool8_32 full);
Expand Down
155 changes: 136 additions & 19 deletions unix/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
extern Uint16 sfc_key[256];
extern bool8_32 Scale;
extern char SaveSlotNum;
extern int vol;
extern short vol;

extern void S9xDisplayString (const char *string, uint8 *, uint32, int ypos);
void save_screenshot(char *fname);
Expand All @@ -41,6 +41,11 @@ bool8_32 highres_current = false;
char snapscreen[17120]={};
extern clock_t start;

void sys_sleep(int us)
{
if(us>0) SDL_Delay(us/1000);
}

void menu_dispupdate(void){
char temp[256];
char disptxt[20][256];
Expand Down Expand Up @@ -197,14 +202,14 @@ void menu_loop(void)
S9xInitDisplay(0, 0);

menu_dispupdate();
usleep(100000);
sys_sleep(100000); //usleep(100000);

SDL_Event event;

do
{
menu_dispupdate();
usleep(100);
sys_sleep(100); //usleep(100);

#ifdef CAANOO
keyssnes = SDL_JoystickOpen(0);
Expand All @@ -220,17 +225,107 @@ void menu_loop(void)
// CAANOO -------------------------------------------------------------
case SDL_JOYBUTTONDOWN:
keyssnes = SDL_JoystickOpen(0);

if ( (SDL_JoystickGetAxis(keyssnes, 1) < -20000) || SDL_JoystickGetButton(keyssnes, sfc_key[START_1]) )
cursor--;
else if( (SDL_JoystickGetAxis(keyssnes, 1) > 20000) || SDL_JoystickGetButton(keyssnes, sfc_key[SELECT_1]) )
cursor++;
else if( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) || (SDL_JoystickGetAxis(keyssnes, 0) < -20000) )
{
switch(cursor)
{
case 2:
if ( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) )
{
S9xReset();
exit_loop = TRUE;
}
break;
case 3:
if ( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) )
{
memcpy(snapscreen,snapscreen_tmp,16050);
show_screenshot();
strcpy(fname," Saving...");
S9xDisplayString (fname, GFX.Screen +280, 640,204);
S9xDeinitUpdate (320, 240);
sprintf(ext, ".s0%d", SaveSlotNum);
strcpy(fname, S9xGetFilename (ext));
save_screenshot(fname);
sprintf(ext, ".00%d", SaveSlotNum);
strcpy(fname, S9xGetFilename (ext));
S9xFreezeGame (fname);
sync();
exit_loop = TRUE;
}
break;
case 4:
if ( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) )
{
sprintf(ext, ".00%d", SaveSlotNum);
strcpy(fname, S9xGetFilename (ext));
S9xLoadSnapshot (fname);
exit_loop = TRUE;
}
break;
case 5:
if ( SDL_JoystickGetAxis(keyssnes, 0) < -20000 )
SaveSlotNum--;
else SaveSlotNum++;
if(SaveSlotNum>3)
SaveSlotNum =0;
else if(SaveSlotNum<0)
SaveSlotNum=3;
break;
case 6:
Settings.DisplayFrameRate = !Settings.DisplayFrameRate;
break;
case 7:
Scale_org = !Scale_org;
break;
case 8:
if (Settings.SkipFrames == AUTO_FRAMERATE)
Settings.SkipFrames = 10;

if ( SDL_JoystickGetAxis(keyssnes, 0) < -20000 )
Settings.SkipFrames--;
else
Settings.SkipFrames++;

if(Settings.SkipFrames>=10)
Settings.SkipFrames = AUTO_FRAMERATE;
else if (Settings.SkipFrames <=1)
Settings.SkipFrames = 1;
break;
case 9:
if ( SDL_JoystickGetAxis(keyssnes, 0) < -20000 )
vol -= 10;
else vol += 10;
if(vol>=100)
vol = 100;
else if (vol <=0)
vol = 0;
break;
case 10:
if ( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) )
ShowCredit();
break;
case 11:
if ( SDL_JoystickGetButton(keyssnes, sfc_key[A_1]) )
S9xExit();
break;
}
}
#else
//PANDORA & DINGOO ------------------------------------------------------
case SDL_KEYDOWN:
keyssnes = SDL_GetKeyState(NULL);

if(keyssnes[sfc_key[UP_1]] == SDL_PRESSED)
cursor--;
else if(keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED)
cursor++;
else if((keyssnes[sfc_key[A_1]] == SDL_PRESSED)||
(keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED)||
(keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED))
else if( (keyssnes[sfc_key[A_1]] == SDL_PRESSED)|| (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) )
{
switch(cursor)
{
Expand Down Expand Up @@ -413,7 +508,8 @@ void capt_screenshot() //107px*80px
}
}

void show_screenshot(){
void show_screenshot()
{
int s=0;
for(int y=126;y<126+80;y++){
for(int x=248; x<248+107*2; x+=2){
Expand All @@ -424,7 +520,8 @@ void show_screenshot(){
}
}

int batt_level(void){
int batt_level(void)
{
FILE *FP;
int mvolts;
char buf[6]={};
Expand All @@ -436,7 +533,8 @@ int batt_level(void){
return (mvolts);
}

int chk_hold(void){
int chk_hold(void)
{
FILE *FP;
uint32 hold=0;
char buf[12]={};
Expand All @@ -451,7 +549,8 @@ int chk_hold(void){
return (0);
}

int get_lcd_backlight(void){
int get_lcd_backlight(void)
{
FILE *FP;
int backlight=0;
char buf[12];
Expand All @@ -463,25 +562,31 @@ int get_lcd_backlight(void){
return (backlight);
}

void set_lcd_backlight(int bk){
void set_lcd_backlight(int bk)
{

char buf[128];
sprintf(buf,"echo %d >/proc/jz/lcd_backlight",bk);
system(buf);
//sync();
}

void ShowCredit(){
uint8 *keyssnes;
void ShowCredit()
{
#ifdef CAANOO
SDL_Joystick* keyssnes = 0;
#else
uint8 *keyssnes = 0;
#endif
int line=0,ypix=0;
char disptxt[100][256]={
"",
"",
"",
"",
" Snes9x4D for Dingux",
" Snes9x4X",
" ",
" Thank you using Snes9x4D! ",
" Thank you using this Emulator! ",
" ",
" Key Configurations, ",
" State Save: START + R ",
Expand All @@ -496,11 +601,17 @@ void ShowCredit(){
" regards to joyrider & g17"
};

do{
do
{
SDL_Event event;
SDL_PollEvent(&event);

#ifdef CAANOO
keyssnes = SDL_JoystickOpen(0);
#else
keyssnes = SDL_GetKeyState(NULL);

#endif

for(int y=12; y<=212; y++){
for(int x=10; x<246*2; x+=2){
memset(GFX.Screen + 320*y*2+x,0x11,2);
Expand All @@ -520,8 +631,14 @@ void ShowCredit(){
}
if(line == 20) line = 0;
S9xDeinitUpdate (320, 240);
usleep(30000);
}while(keyssnes[sfc_key[B_1]] != SDL_PRESSED);
sys_sleep(30000); //usleep(30000);
}
#ifdef CAANOO
while( SDL_JoystickGetButton(keyssnes, sfc_key[A_1])!=TRUE );
#else
while(keyssnes[sfc_key[B_1]] != SDL_PRESSED);
#endif

return;
}

Loading

0 comments on commit d019ee8

Please sign in to comment.