Compare commits

...

3 Commits
v1 ... master

Author SHA1 Message Date
IniKiwi db00b8b5cd windows and linux executables (with -static) 2021-10-20 14:30:17 +02:00
IniKiwi 32fc6f0eca linux and windows gui (python) 2021-10-20 14:23:54 +02:00
IniKiwi 53c1eec576 executable return error codes 2021-10-19 21:44:42 +02:00
5 changed files with 124 additions and 12 deletions

BIN
G35EIIcompatibility-tool.elf Executable file

Binary file not shown.

BIN
G35EIIcompatibility-tool.exe Executable file

Binary file not shown.

56
linux-gui.py Executable file
View File

@ -0,0 +1,56 @@
#! /usr/bin/python3
import tkinter as tk
from tkinter import ttk
import tkinter.filedialog
import tkinter.messagebox
import subprocess
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title('MonochromeLib add-in converter win64')
self.file = tk.StringVar()
self.gui_fileframe = tk.Frame(self)
self.gui_fileframe.grid(row=0, column=0, columnspan=2, sticky="news", pady=5, padx=5)
self.gui_filename_label = tk.Label(self.gui_fileframe, text="filepath:")
self.gui_filename_label.grid(row=0, column=0, sticky="news")
self.gui_filename = tk.Entry(self.gui_fileframe, width=50)
self.gui_filename.grid(row=0, column=1, sticky="news")
self.gui_open = tk.Button(command=self.app_open_addin, text="open add-in",)
self.gui_open.grid(row=1, column=0)
self.gui_convert = tk.Button(command=self.app_convert, text="convert...",)
self.gui_convert.grid(row=1, column=1)
def app_open_addin(self):
filename = tk.filedialog.askopenfilename(title="Open a File", filetypes=[('casio add-in', '.g1a'), ('all files', '.*')])
self.gui_filename.delete(0, tk.END)
self.gui_filename.insert(0, filename)
return filename
def app_convert(self):
ex = tk.filedialog.asksaveasfilename(title="Save Add-in", filetypes=[('casio add-in', '.g1a'), ('all files', '.*')])
process = subprocess.Popen("./G35EIIcompatibility-tool.elf " +
self.gui_filename.get() +
" " + ex, shell=True, stdout=subprocess.PIPE)
process.wait()
if process.returncode == 0:
tk.messagebox.showinfo(None, "add-in converted!")
elif process.returncode == 4:
tk.messagebox.showwarning(None, "this file are: \n-not a add-in\n-already a converted add-in\n-not a monochromelib add-in")
elif process.returncode == 2:
tk.messagebox.showerror(None, "no output(export) file!")
elif process.returncode == 3:
tk.messagebox.showerror(None, "cannot open file!")
else:
tk.messagebox.showerror(None, "error!\nerrorcode: "+str(process.returncode))
if __name__ == "__main__":
app = App()
app.mainloop()

24
main.c
View File

@ -2,29 +2,29 @@
#include <stdlib.h>
#include <unistd.h>
unsigned char convert_table[] = {
//origin converted
0xeb,0x07, 0xeb,0x0a, //first address to find!
0xe1,0x00, 0xe1,0x04,
0xe7,0x04, 0xe7,0x08,
0xe2,0xc0, 0xe2,0x80,
0x60,0x13, 0xe0,0x00
};
int main(int argc, char **argv){
unsigned char convert_table[] = {
//origin converted
0xeb,0x07, 0xeb,0x0a, //first address to find!
0xe1,0x00, 0xe1,0x04,
0xe7,0x04, 0xe7,0x08,
0xe2,0xc0, 0xe2,0x80,
0x60,0x13, 0xe0,0x00
};
if(argc == 1){
printf("\033[1;31m"); //red
printf("error: ");
printf("\033[0;37m"); //white
printf("no input and output file!\n");
return -1;
return 1;
}
if(argc == 2){
printf("\033[1;31m"); //red
printf("error: ");
printf("\033[0;37m"); //white
printf("no output file!\n");
return -1;
return 2;
}
if(access(argv[1], F_OK ) == 0) {
@ -34,7 +34,7 @@ int main(int argc, char **argv){
printf("error: ");
printf("\033[0;37m"); //white
printf("cannot open file!\n");
return -1;
return 3;
}
printf("\033[0;37m"); //white text
@ -86,7 +86,7 @@ int main(int argc, char **argv){
printf("error: ");
printf("\033[0;37m"); //white
printf("no valid file or no data to edit\n");
return -1;
return 4;
}

56
windows-gui.py Executable file
View File

@ -0,0 +1,56 @@
#! /usr/bin/python3
import tkinter as tk
from tkinter import ttk
import tkinter.filedialog
import tkinter.messagebox
import subprocess
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title('MonochromeLib add-in converter win64')
self.file = tk.StringVar()
self.gui_fileframe = tk.Frame(self)
self.gui_fileframe.grid(row=0, column=0, columnspan=2, sticky="news", pady=5, padx=5)
self.gui_filename_label = tk.Label(self.gui_fileframe, text="filepath:")
self.gui_filename_label.grid(row=0, column=0, sticky="news")
self.gui_filename = tk.Entry(self.gui_fileframe, width=50)
self.gui_filename.grid(row=0, column=1, sticky="news")
self.gui_open = tk.Button(command=self.app_open_addin, text="open add-in",)
self.gui_open.grid(row=1, column=0)
self.gui_convert = tk.Button(command=self.app_convert, text="convert...",)
self.gui_convert.grid(row=1, column=1)
def app_open_addin(self):
filename = tk.filedialog.askopenfilename(title="Open a File", filetypes=[('casio add-in', '.g1a'), ('all files', '.*')])
self.gui_filename.delete(0, tk.END)
self.gui_filename.insert(0, filename)
return filename
def app_convert(self):
ex = tk.filedialog.asksaveasfilename(title="Save Add-in", filetypes=[('casio add-in', '.g1a'), ('all files', '.*')])
process = subprocess.Popen("./G35EIIcompatibility-tool.exe " +
self.gui_filename.get() +
" " + ex, shell=True, stdout=subprocess.PIPE)
process.wait()
if process.returncode == 0:
tk.messagebox.showinfo(None, "add-in converted!")
elif process.returncode == 4:
tk.messagebox.showwarning(None, "this file are: \n-not a add-in\n-already a converted add-in\n-not a monochromelib add-in")
elif process.returncode == 2:
tk.messagebox.showerror(None, "no output(export) file!")
elif process.returncode == 3:
tk.messagebox.showerror(None, "cannot open file!")
else:
tk.messagebox.showerror(None, "error!\nerrorcode: "+str(process.returncode))
if __name__ == "__main__":
app = App()
app.mainloop()