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

Clean commandline options and references to network #46

Draft
wants to merge 5 commits into
base: master
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: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SOURCES = hdl_dump.c \
iin_img_base.c iin_optical.c iin_iso.c iin_cdrwin.c \
iin_nero.c iin_gi.c iin_iml.c iin_probe.c iin_hio.c \
hio_probe.c hio_win32.c hio_dbg.c hio_trace.c \
net_common.c byteseq.c dict.c hio_udpnet2.c
byteseq.c dict.c

# "autodetect" Windows builds
ifdef SYSTEMROOT
Expand Down
1 change: 0 additions & 1 deletion common.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#define MAX_READ_FILE_SIZE (4 * 1024 * 1024) /* 4MB */


/**************************************************************/
char *
ltrim(char *text)
Expand Down
1 change: 1 addition & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ C_START
#define MAX_PATH 1024
#endif

#define HDD_SECTOR_SIZE 512 /* HDD sector size in bytes */

char *ltrim(/*@returned@*/ char *text);

Expand Down
28 changes: 0 additions & 28 deletions hdl_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#include "aligned.h"
#include "hio.h"
#include "dict.h"
#include "net_io.h"

#define UNBOLD "\033[0m"
#define BOLD "\033[1m"
Expand Down Expand Up @@ -90,7 +89,6 @@
#define CMD_HDL_INSTALL "install"
#define CMD_CDVD_INFO "cdvd_info"
#define CMD_CDVD_INFO2 "cdvd_info2"
#define CMD_POWER_OFF "poweroff"
#if defined(INCLUDE_INJECT_MBR_CMD)
#define CMD_INJECT_MBR "inject_mbr"
#endif
Expand Down Expand Up @@ -1228,21 +1226,6 @@ copy_hdd(const dict_t *config,
}


/**************************************************************/
static int
remote_poweroff(const dict_t *config,
const char *ip)
{
/*@only@*/ hio_t *hio = NULL;
int result = hio_probe(config, ip, &hio);
if (result == RET_OK && hio != NULL) {
result = hio->poweroff(hio);
(void)hio->close(hio), hio = NULL;
}
return (result);
}


/**************************************************************/
static volatile int sigint_catched = 0;

Expand Down Expand Up @@ -1397,9 +1380,6 @@ show_usage_and_exit(const char *app_path,
{CMD_CDVD_INFO2, "iin_input",
"display media type, startup ELF, volume label and data size for a CD-/DVD-drive or image file", NULL,
"c:\\gt3.gi", "\"hdd2:Gran Turismo 3\"", 0},
{CMD_POWER_OFF, "ip",
"power off Playstation 2", NULL,
"192.168.0.10", NULL, 0},
#if defined(INCLUDE_INJECT_MBR_CMD)
{CMD_INJECT_MBR, "device input_file",
"inject input_file into MBR",
Expand Down Expand Up @@ -1968,14 +1948,6 @@ int main(int argc, char *argv[])
argv[2], NULL);
}

else if (caseless_compare(command_name, CMD_POWER_OFF)) { /* PS2 power-off */
if (argc != 3)
show_usage_and_exit(argv[0], CMD_POWER_OFF);

handle_result_and_exit(remote_poweroff(config, argv[2]),
argv[2], NULL);
}

#if defined(INCLUDE_INJECT_MBR_CMD)
else if (caseless_compare(command_name, CMD_INJECT_MBR)) { /* prepare a HDD for HDL usage */
if (argc != 4)
Expand Down
3 changes: 0 additions & 3 deletions hio.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ typedef int (*hio_write_t)(hio_t *hio,

typedef int (*hio_flush_t)(hio_t *hio);

typedef int (*hio_poweroff_t)(hio_t *hio);

typedef int (*hio_close_t)(/*@special@*/ /*@only@*/ hio_t *hio) /*@releases hio@*/;

/* return last error text in a memory buffer, that would be freed by calling hio_dispose_error_t */
Expand All @@ -72,7 +70,6 @@ struct hio_type
hio_write_t write;
hio_flush_t flush;
hio_close_t close;
hio_poweroff_t poweroff;
hio_last_error_t last_error;
hio_dispose_error_t dispose_error;
};
Expand Down
11 changes: 1 addition & 10 deletions hio_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
*/

#include "hio_dbg.h"
#include "net_io.h"
#include "osal.h"
#include "retcodes.h"
#include "common.h"
#include <stdio.h>
#include <string.h>


typedef struct hio_dbg_type
{
hio_t hio;
Expand Down Expand Up @@ -162,13 +161,6 @@ dbg_write(hio_t *hio,
}


/**************************************************************/
static int
dbg_poweroff(hio_t *hio)
{
return (RET_OK);
}


/**************************************************************/
static int
Expand Down Expand Up @@ -226,7 +218,6 @@ dbg_alloc(const char *dump_path)
dbg->hio.write = &dbg_write;
dbg->hio.flush = &dbg_flush;
dbg->hio.close = &dbg_close;
dbg->hio.poweroff = &dbg_poweroff;
dbg->hio.last_error = &dbg_last_error;
dbg->hio.dispose_error = &dbg_dispose_error;
dbg->error_code = 0;
Expand Down
3 changes: 0 additions & 3 deletions hio_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/

#include "hio_win32.h"
#include "hio_udpnet2.h"
#include "hio_dbg.h"
#include "hio_trace.h"
#include "retcodes.h"
Expand All @@ -38,8 +37,6 @@ int hio_probe(const dict_t *config,
result = hio_trace_probe(config, path, hio);
if (result == RET_NOT_COMPAT)
result = hio_dbg_probe(config, path, hio);
if (result == RET_NOT_COMPAT)
result = hio_udpnet2_probe(config, path, hio);
if (result == RET_NOT_COMPAT)
result = hio_win32_probe(config, path, hio);
return (result);
Expand Down
14 changes: 0 additions & 14 deletions hio_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ trace_write(hio_t *hio,
}


/**************************************************************/
static int
trace_poweroff(hio_t *hio)
{
hio_trace_t *trace = (hio_trace_t *)hio;
int result;
fprintf(trace->log, "hio->poweroff (%p", (void *)trace->real);
result = trace->real->poweroff(trace->real);
fprintf(trace->log, ") = %d\n", result);
return (result);
}


/**************************************************************/
static int
Expand All @@ -114,7 +102,6 @@ trace_flush(hio_t *hio)
hio_trace_t *trace = (hio_trace_t *)hio;
int result;
fprintf(trace->log, "hio->flush (%p", (void *)trace->real);
result = trace->real->poweroff(trace->real);
fprintf(trace->log, ") = %d\n", result);
return (result);
}
Expand Down Expand Up @@ -173,7 +160,6 @@ trace_alloc(hio_t *real)
trace->hio.write = &trace_write;
trace->hio.flush = &trace_flush;
trace->hio.close = &trace_close;
trace->hio.poweroff = &trace_poweroff;
trace->hio.last_error = &trace_last_error;
trace->hio.dispose_error = &trace_dispose_error;

Expand Down
9 changes: 0 additions & 9 deletions hio_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ win32_flush(/*@unused@*/ hio_t *hio)
}


/**************************************************************/
static int
win32_poweroff(/*@unused@*/ hio_t *hio)
{ /* win32_poweroff is intentionately blank */
return (RET_OK);
}


/**************************************************************/
static int
win32_close(/*@special@*/ /*@only@*/ hio_t *hio) /*@releases hio@*/
Expand Down Expand Up @@ -151,7 +143,6 @@ win32_alloc(osal_handle_t device) /*@allocates result@*/ /*@defines result@*/
hw32->hio.read = &win32_read;
hw32->hio.write = &win32_write;
hw32->hio.flush = &win32_flush;
hw32->hio.poweroff = &win32_poweroff;
hw32->hio.close = &win32_close;
hw32->hio.last_error = &win32_last_error;
hw32->hio.dispose_error = &win32_dispose_error;
Expand Down