Skip to content

Commit

Permalink
Merge pull request #385 from AliceLR/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes not worth their own individual PRs.

* Fixed system time counters not updating in the variable debugger on refresh.
* Fixed MegaZeux's built-in mixer resample mode variable name.
* Bumped DJGPP's default module mixing mode back up to linear (from nearest).
* Fixed 1.x centered message column values being imported incorrectly.
* Fixed about.c license file list not getting fully populated in DOS with LFNs disabled.
* Fixed licenses not displaying in the 3DS port when using executable paths other than `/3ds/megazeux`.
* Fixed "3rd Party" appearing before "License" in the license list on platforms without sorted dirent.
  • Loading branch information
AliceLR authored Oct 29, 2023
2 parents 50e26cf + c6c5300 commit 13c3eb7
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 20 deletions.
2 changes: 1 addition & 1 deletion arch/nds/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void init_audio_platform(struct config_info *conf)
pcs_frequency = 0;
pcs_duration = 0;

// master volume init
// global volume init
nds_sound_volume(10);

// maxmod init
Expand Down
2 changes: 1 addition & 1 deletion config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ if [ "$PLATFORM" = "unix" ] || [ "$PLATFORM" = "darwin" ]; then
echo "#define SHAREDIR \"$SHAREDIR/megazeux/\"" >> src/config.h
echo "#define LICENSEDIR \"$LICENSEDIR/megazeux/\"" >> src/config.h
else
LICENSEDIR=$SHAREDIR
LICENSEDIR="."
GAMESDIR=$SHAREDIR
BINDIR=$SHAREDIR
echo "#define CONFFILE \"config.txt\"" >> src/config.h
Expand Down
2 changes: 1 addition & 1 deletion config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@

# enable_oversampling = 0

# Set master resample mode. This affects how OGGs, SAMs, WAVs, and
# Set global resample mode. This affects how OGGs, SAMs, WAVs, RADs, and
# frequency shifted modules sound. Choices are:
# none (fastest, poor quality)
# linear (fast, good quality)
Expand Down
33 changes: 22 additions & 11 deletions src/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "io/path.h"
#include "io/vio.h"

#include <ctype.h>
#include <zlib.h>

#ifdef CONFIG_SDL
Expand Down Expand Up @@ -211,8 +212,8 @@ static void load_license_list(char *names[MAX_FILES], char *files[MAX_FILES],
vdir *dir;
enum vdir_type type;
char buf[MAX_PATH];
int license = -1;
int license_3rd = -1;
char *license = NULL;
char *license_3rd = NULL;
int num_files = 0;
int i = 0;

Expand All @@ -227,21 +228,28 @@ static void load_license_list(char *names[MAX_FILES], char *files[MAX_FILES],
if(type == DIR_TYPE_DIR)
continue;

if((!strcasecmp(buf, "LICENSE") || !strcasecmp(buf, "LICENSE.")) && license == -1)
if((!strcasecmp(buf, "LICENSE") || !strcasecmp(buf, "LICENSE.")) && !license)
{
names[num_files] = about_line("License");
files[num_files++] = about_line("%s", buf);
license = i;
license = about_line("%s", buf);
}
else

if(!strcasecmp(buf, "LICENSE.3rd") && license_3rd == -1)
if(!strcasecmp(buf, "LICENSE.3rd") && !license_3rd)
{
names[num_files] = about_line("3rd Party");
files[num_files++] = about_line("%s", buf);
license_3rd = i;
license_3rd = about_line("%s", buf);
}
}
// MegaZeux's license should always go first.
if(license)
{
names[num_files] = about_line("License");
files[num_files++] = license;
}
if(license_3rd)
{
names[num_files] = about_line("3rd Party");
files[num_files++] = license_3rd;
}

// Pass 2: add all other license files.
vdir_rewind(dir);
Expand All @@ -260,7 +268,10 @@ static void load_license_list(char *names[MAX_FILES], char *files[MAX_FILES],
#ifdef CONFIG_DJGPP
else

if(!strncasecmp(buf, "LICENS~1.", 9) && buf[9])
/* Even if the extensions are completely different, having multiple of
* these licenses might cause SFN numbers greater than 1. */
if(!strncasecmp(buf, "LICENS~", 7) && isdigit((unsigned char)buf[7]) &&
buf[8] == '.' && buf[9] != '\0')
{
names[num_files] = about_line("%-.16s", buf + 9);
files[num_files++] = about_line("%s", buf);
Expand Down
2 changes: 1 addition & 1 deletion src/audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void init_audio(struct config_info *conf)
#endif

audio.output_frequency = conf->output_frequency;
audio.master_resample_mode = conf->resample_mode;
audio.global_resample_mode = conf->resample_mode;

audio.max_simultaneous_samples = -1;
audio.max_simultaneous_samples_config = conf->max_simultaneous_samples;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/audio_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct audio
size_t buffer_samples;

size_t output_frequency;
unsigned int master_resample_mode;
unsigned int global_resample_mode;
int max_simultaneous_samples;
int max_simultaneous_samples_config;

Expand Down
2 changes: 1 addition & 1 deletion src/audio/sampled_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void sampled_mix_data(struct sampled_stream *s_src,
int16_t *src_buffer = (int16_t *)(output_data + s_src->prologue_length);
size_t write_len = dest_frames * dest_channels;
int volume = ((struct audio_stream *)s_src)->volume;
int resample_mode = audio.master_resample_mode + 1;
int resample_mode = audio.global_resample_mode + 1;
enum mixer_volume use_volume = DYNAMIC;
enum mixer_channels use_channels = STEREO;

Expand Down
2 changes: 1 addition & 1 deletion src/configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

#ifdef CONFIG_DJGPP
#define RESAMPLE_MODE_DEFAULT RESAMPLE_MODE_NONE
#define MOD_RESAMPLE_MODE_DEFAULT RESAMPLE_MODE_NONE
#define MOD_RESAMPLE_MODE_DEFAULT RESAMPLE_MODE_LINEAR
#define FULLSCREEN_DEFAULT 1
// Uncomment if Ogg Vorbis files need to be forced into memory.
//#define VFS_ENABLE_DEFAULT true
Expand Down
14 changes: 14 additions & 0 deletions src/editor/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,15 @@ enum board_node_ids
NUM_BOARD_NODES
};

/**
* Some variable values may be cached, such as the clock time.
* This resets those values so they will update when the var list refreshes.
*/
static void clear_cached_data(struct world *mzx_world)
{
mzx_world->command_cache = 0;
}

// Create new counter lists.
// (Re)make the child nodes
static void repopulate_tree(struct world *mzx_world, struct debug_node *root)
Expand All @@ -2367,6 +2376,8 @@ static void repopulate_tree(struct world *mzx_world, struct debug_node *root)
// Clear the debug tree recursively (but preserve the base structure).
clear_debug_tree(root, false);

clear_cached_data(mzx_world);

// Initialize the tree.
init_counters_node(mzx_world, &(root->nodes[NODE_COUNTERS]));
init_strings_node(mzx_world, &(root->nodes[NODE_STRINGS]));
Expand Down Expand Up @@ -3277,8 +3288,11 @@ void __debug_counters(context *ctx)
}
}
if(focus->refresh_on_focus)
{
clear_cached_data(mzx_world);
for(i = 0; i < focus->num_vars; i++)
read_var(mzx_world, &(focus->vars[i]));
}

// If the current position in the tree was changed by a search, bring it
// to focus in the tree list. This should only be used after a search.
Expand Down
7 changes: 5 additions & 2 deletions src/legacy_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,11 @@ int legacy_load_board_direct(struct world *mzx_world, struct board *cur_board,
cur_board->scroll_x = (signed char)vfgetc(vf);
cur_board->scroll_y = (signed char)vfgetc(vf);

// Fix world default centered value for message column...
if(!savegame && cur_board->b_mesg_col == 0)
// World files have different values to indicate centered messages,
// typically -128. VER1TO2 fixes values <=0 and >=80. However, in save
// files 0 corresponds to column 0 (as with later versions).
if(cur_board->b_mesg_col < 0 || cur_board->b_mesg_col >= 80 ||
(!savegame && cur_board->b_mesg_col == 0))
cur_board->b_mesg_col = -1;
}
}
Expand Down

0 comments on commit 13c3eb7

Please sign in to comment.