Skip to content

Commit

Permalink
AddeWindows "Drag and Drop" build
Browse files Browse the repository at this point in the history
  - Allows drag-and-drop a ROM/.noi/etc file onto the console `romusage_drag_and_drop.exe` program
  - Romusage will load the file, open a console window to show output and wait for a key press before closing
  - Uses defaults (it can't accept option settings) : `-sRp -g -B`
  • Loading branch information
bbbbbr committed May 18, 2023
1 parent f8f55ce commit 6d77a29
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ Changelog
- Collapses banked regions to single lines: [Region]_[Max Used Bank] / [auto-sized Max Bank Num]
- Example: ROM_1...ROM_12 -> ROM_12/15
- Range column is unmodified. Size, used, free, graph, are adjusted to represent total size of merged banks

- Added `-F` : Force Displayed Max ROM and SRAM bank num for -B. (0 based) -F:ROM:SRAM (ex: -F:255:15)

- Added combined non-banked region + banked to a single line mode
- `-smWRAM` : Combined WRAM_0 and WRAM_1 display (i.e DMG/MGB not CGB)
- `-smROM` : Combined ROM_0 and ROM_1 display (i.e. bare 32K ROM)
- Compatible with banked ROM_x or WRAM_x when used with `-B`

- Added Windows "Drag and Drop" build
- Allows drag-and-drop a ROM/.noi/etc file onto the console `romusage_drag_and_drop.exe` program
- Romusage will load the file, open a console window to show output and wait for a key press before closing
- Uses defaults (it can't accept option settings) : `-sRp -g -B`

# Version 1.2.4
- Fix: Support spaces in RGBDS map file section (area) names

Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ MKDIRS = $(OBJDIR) $(BINDIR) $(PACKDIR)
CFILES = $(wildcard $(SRCDIR)/*.c)
COBJ = $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(CFILES))

BIN = $(BINDIR)/romusage
ifdef DRAG_AND_DROP_MODE
EXTRA_FNAME = _drag_and_drop
CFLAGS+= -DDRAG_AND_DROP_MODE
endif
BIN = $(BINDIR)/romusage$(EXTRA_FNAME)
BIN_WIN = $(BIN).exe


Expand Down Expand Up @@ -75,8 +79,11 @@ package:
${MAKE} clean
${MAKE} wincrosszip
${MAKE} clean
${MAKE} wincrosszip DRAG_AND_DROP_MODE=TRUE
${MAKE} clean
${MAKE} linuxzip


# create necessary directories after Makefile is parsed but before build
# info prevents the command from being pasted into the makefile
$(info $(shell mkdir -p $(MKDIRS)))
20 changes: 20 additions & 0 deletions src/romusage.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ static void display_help(void) {
}


// Default options for Windows Drag and Drop recipient mode
void set_drag_and_drop_mode_defaults(void) {

set_option_color_mode(OPT_PRINT_COLOR_ROW_ENDS);
banks_output_show_minigraph(true);
set_option_summarized(true);
}


int handle_args(int argc, char * argv[]) {

int i;
Expand Down Expand Up @@ -233,6 +242,11 @@ int main( int argc, char *argv[] ) {

init();

#ifdef DRAG_AND_DROP_MODE
// Non-interactive mode, set some reasonable default
set_drag_and_drop_mode_defaults();
#endif

if (handle_args(argc, argv)) {

banks_init_templates();
Expand Down Expand Up @@ -288,5 +302,11 @@ int main( int argc, char *argv[] ) {
if (get_exit_error())
ret = EXIT_FAILURE;

#ifdef DRAG_AND_DROP_MODE
// Wait for input to keep the console window open after processing
printf("\n\nPress Any Key to Continue\n");
getchar();
#endif

return ret;
}

0 comments on commit 6d77a29

Please sign in to comment.