Compare commits

...
Sign in to create a new pull request.

12 commits

Author SHA1 Message Date
Jacob Young
90bd5c0416 Add device icon. 2021-04-14 10:59:45 -04:00
Jacob Young
b0046f3f0e Mac compatibility I guess. 2021-04-14 10:59:16 -04:00
Jacob Young
45980d5c1c Tag 0.0.2b release. 2021-04-13 22:32:05 -04:00
Jacob Young
81e5234be1 Fix image file names. 2021-04-13 22:31:46 -04:00
Jacob Young
47e228f052 Update readme. 2021-04-13 21:39:14 -04:00
Jacob Young
0928c2855c Add some missing checks. 2021-04-13 21:39:14 -04:00
Jacob Young
8cd1815417 Fix receiving archived unnamed variables. 2021-04-13 21:39:14 -04:00
Jacob Young
96833322de Fix sending in data that is a multiple of the max packet size. 2021-04-13 21:14:18 -04:00
Jacob Young
18adbb523c Add nautilus as a supported ubuntu file browser. 2021-04-13 11:39:02 -04:00
Jacob Young
c0b584ac77 Add license. 2021-04-13 04:28:51 -04:00
Jacob Young
6b39fe15f8 Add known working computer OS instructions to README. 2021-04-13 04:14:57 -04:00
Jacob Young
ce2d78cc25 Tag 0.0.1b release. 2021-04-13 03:54:38 -04:00
19 changed files with 270 additions and 126 deletions

3
.gitignore vendored
View file

@ -1,4 +1,7 @@
icon/ti83pce.ico
icon/ti84pce.ico
font/genfont
src/font.*
src/*_icon.*
obj/*
bin/*

8
CHANGELOG.md Normal file
View file

@ -0,0 +1,8 @@
# prgmTRANSFER
## v0.0.1b
- Initial beta release
## v0.0.2b
- Fix corrupted screen, crash, or garbage data when receiving some variables from Archive.
- Fix incorrect file names for images.

19
LICENSE Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2019 - 2021 Jacob "jacobly" Young
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,4 +1,4 @@
# prgmTRANSFER
# prgmTRANSFER v0.0.2b
### This software is still in beta, no liability for corrupted or lost files, etc!
@ -7,6 +7,11 @@ Running this program on the calculator will allow you to transfer variable files
Windows 10/Ubuntu 20.04/Android with preinstalled software, or other OSes with various
PTP or MTP transfer software.
## Known Working Computer OSes
- Windows 10 using the default file explorer, check under Computer after connecting.
- Ubuntu 20.04 using the default Gnome Files (nautilus) or Dolphin.
- Android 11 using the builtin Files application, check notifications after connecting to open.
## Installation
1. Send [TRANSFER.8xp release](https://github.com/jacobly0/transfer/releases/latest) and [nightly clibs.8xg from usbdrvce branch](https://jacobly.com/a/toolchain/usbdrvce/clibs.zip) to your calculator using other transfer software.
1. Run `Asm(prgmTRANSFER)` and then plug-and-play with a usb cable to supported OSes, or using supported software.
@ -23,7 +28,8 @@ PTP or MTP transfer software.
- [ ] Receiving a rom dump.
- [ ] Copying variables in either RAM or Archive to another name in either RAM or Archive.
- [x] Getting free space in RAM or Archive.
- [x] Geting and seting the current time.
- [x] Geting the current battery level.
- [ ] Geting a device icon for displaying in MTP program UIs.
- [x] Getting the current time.
- [ ] Setting the current time.
- [x] Getting the current battery level.
- [ ] ~~Getting a device icon for displaying in MTP program UIs.~~
- [ ] Optimize for a smaller program size.

View file

@ -5,14 +5,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <uchar.h>
int main(int argc, char **argv) {
FT_Library library;
FT_Error error;
FT_Face face;
if ((error = FT_Init_FreeType(&library)) ||
(error = FT_New_Face(library, "/usr/share/fonts/fonts-master/apache/robotomono/RobotoMono-Medium.ttf", 0, &face)) ||
((error = FT_New_Face(library, "/usr/share/fonts/fonts-master/apache/robotomono/RobotoMono-Medium.ttf", 0, &face)) &&
(error = FT_New_Face(library, "/Library/Fonts/RobotoMono-Medium.ttf", 0, &face))) ||
(error = FT_Set_Char_Size(face, 0, 550, 0, 141)) ||
(error = FT_Load_Char(face, U'w', FT_LOAD_DEFAULT))) return error;
int width = face->glyph->advance.x >> 6, height = face->size->metrics.height >> 6, height_bytes = (height + 1) >> 1;
@ -45,7 +45,7 @@ int main(int argc, char **argv) {
"const uint8_t font[0x100][FONT_WIDTH][FONT_HEIGHT_BYTES] = {\n");
uint8_t *bitmap = calloc(width, height_bytes);
if (!bitmap) return 1;
for (char32_t c = U'\0'; c <= U'\xFF'; ++c) {
for (uint32_t c = U'\0'; c <= U'\xFF'; ++c) {
memset(bitmap, 0, width * height_bytes);
if ((error = FT_Load_Char(face, c, FT_LOAD_DEFAULT)) ||
(error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL))) return error;

BIN
icon/ti83pce-128.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
icon/ti83pce-256.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
icon/ti83pce-32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
icon/ti83pce-64.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
icon/ti84pce-128.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
icon/ti84pce-256.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
icon/ti84pce-32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
icon/ti84pce-64.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

@ -2,18 +2,26 @@
# Makefile Options
# ----------------------------
NAME ?= TRANSFER
ICON ?= transfer.png
DESCRIPTION ?= "Variable Transfer Program"
COMPRESSED ?= YES
ARCHIVED ?= YES
CC = clang
CONVERT = convert
PRINTF = printf
CFLAGS ?= -Wall -Wextra -Oz
CXXFLAGS ?= -Wall -Wextra -Oz
NAME = TRANSFER
ICON = icon/transfer.png
DESCRIPTION = "Variable Transfer Program"
COMPRESSED = YES
ARCHIVED = YES
EXTRA_CSOURCES ?= $(if $(wildcard src/font.c),,src/font.c)
EXTRA_USERHEADERS ?= src/ti84pceg.inc src/font.h
EXTRA_CLEAN ?= src/font.c src/font.h font/genfont
CFLAGS = -Wall -Wextra -Oz
CXXFLAGS = -Wall -Wextra -Oz
ICON_COLORS = 16
ICON_SIZES = 32 64
GEN_CSOURCES = src/ti83pce_icon.c src/ti84pce_icon.c src/font.c
EXTRA_CSOURCES = $(filter-out $(wildcard $(GEN_CSOURCES)),$(GEN_CSOURCES))
EXTRA_USERHEADERS = src/ti83pce_icon.h src/ti84pce_icon.h src/ti84pceg.inc src/font.h
EXTRA_CLEAN = $(GEN_CSOURCES) $(patsubst %.c,%.h,$(GEN_CSOURCES)) icon/ti83pce.ico icon/ti84pce.ico font/genfont
# ----------------------------
@ -23,8 +31,19 @@ endif
include $(CEDEV)/meta/makefile.mk
icon/%.ico: $(patsubst %,icon/\%-%.ico,$(ICON_SIZES))
@$(CONVERT) $^ -colors $(ICON_COLORS) $@
src/%_icon.h: icon/%.ico
@$(PRINTF) "#ifndef $*_icon_h\n#define $*_icon_h\n\n#define $*_icon_uncompressed_size `wc -c < $<`\nextern const unsigned char $*_icon[];\n\n#endif\n" > $@
src/%_icon.c: icon/%.ico
@$(CONVBIN) --iformat bin --input $< --compress zx7 --name $*_icon --oformat c --output $@
src/font.h src/font.c: font/genfont
@$<
font/genfont: font/genfont.c
@clang -O3 -flto $< `pkg-config --cflags --libs freetype2` -o $@
@$(CC) -O3 -flto $< `pkg-config --cflags --libs freetype2` -o $@
.SECONDARY: $(EXTRA_CLEAN)

View file

@ -14,6 +14,8 @@ typedef struct mtp_global mtp_global_t;
#define usb_transfer_data_t mtp_global_t
/* Includes */
#include "ti83pce_icon.h"
#include "ti84pce_icon.h"
#include "ui.h"
#include "var.h"
@ -21,7 +23,7 @@ typedef struct mtp_global mtp_global_t;
#include <fileioc.h>
#include <usbdrvce.h>
#include <debug.h>
#include <compression.h>
#include <tice.h>
#include <inttypes.h>
@ -38,7 +40,7 @@ typedef struct mtp_global mtp_global_t;
#define COUNT_EACH(...) +1
#define OBJECT_BUFFER \
#define LARGE_BUFFER \
((void *)((mtp_byte_t *)lcd_Ram + LCD_WIDTH * LCD_HEIGHT))
#define FOR_EACH_SUPP_OPR(X) \
@ -59,12 +61,15 @@ typedef struct mtp_global mtp_global_t;
X(SET_DEVICE_PROP_VALUE) \
X(MOVE_OBJECT)
#define FOR_EACH_SUPP_EVT(X)
#define FOR_EACH_SUPP_EVT(X) \
X(OBJECT_ADDED) \
X(OBJECT_REMOVED)
#define FOR_EACH_SUPP_DP(X) \
X(uint8, BATTERY_LEVEL, RANGE) \
X(datetime, DATE_TIME, NONE) \
X(uint32, PERCEIVED_DEVICE_TYPE, NONE)
#define FOR_EACH_SUPP_DP(X) \
X(uint8, BATTERY_LEVEL, RANGE) \
X(datetime, DATE_TIME, NONE) \
X(uint32, PERCEIVED_DEVICE_TYPE, NONE) \
X(auint8, DEVICE_ICON, NONE)
#define FOR_EACH_SUPP_CF(X) \
X(UNDEFINED)
@ -108,32 +113,60 @@ typedef struct mtp_global mtp_global_t;
#define get_arc_free_space_in_bytes \
(os_ArcChk(), os_TempFreeArc)
#define BATTERY_LEVEL_MIN 0
#define BATTERY_LEVEL_MAX 4
#define BATTERY_LEVEL_STEP 1
#define BATTERY_LEVEL_DEF 0
#define BATTERY_LEVEL_GET_SET 0
#define BATTERY_LEVEL_GET(current) \
current = boot_GetBatteryStatus()
#define BATTERY_LEVEL_SET(new)
#define BATTERY_LEVEL_MIN(value) value = 0
#define BATTERY_LEVEL_MAX(value) value = 4
#define BATTERY_LEVEL_STEP(value) value = 1
#define BATTERY_LEVEL_SIZE sizeof
#define BATTERY_LEVEL_DEF(value) value = 0
#define BATTERY_LEVEL_GET_SET 0
#define BATTERY_LEVEL_GET(value) \
value = boot_GetBatteryStatus()
#define BATTERY_LEVEL_SET(value) (void)0
#define DATE_TIME_DEF { \
.length = lengthof(Lfactory_datetime), \
.string = Lfactory_datetime, \
}
#define DATE_TIME_GET_SET 1
#define DATE_TIME_GET(current) \
get_datetime(current.string)
#define DATE_TIME_SET(new)
#define DATE_TIME_SIZE sizeof
#define DATE_TIME_DEF(value) do { \
value.length = \
lengthof(Lfactory_datetime); \
memcpy(value.string, \
Lfactory_datetime, \
sizeof(value.string)); \
} while (0)
#define DATE_TIME_GET_SET 1
#define DATE_TIME_GET(value) \
get_datetime(value.string)
#define DATE_TIME_SET(value) (void)0
#define PERCEIVED_DEVICE_TYPE_DEF 0
#define PERCEIVED_DEVICE_TYPE_GET_SET 0
#define PERCEIVED_DEVICE_TYPE_GET(current) \
current = 3
#define PERCEIVED_DEVICE_TYPE_SET(new)
#define PERCEIVED_DEVICE_TYPE_SIZE sizeof
#define PERCEIVED_DEVICE_TYPE_DEF(value) value = 0
#define PERCEIVED_DEVICE_TYPE_GET_SET 0
#define PERCEIVED_DEVICE_TYPE_GET(value) value = 3
#define PERCEIVED_DEVICE_TYPE_SET(value) (void)0
#define DEVICE_ICON_SIZE(type) \
(sizeof(mtp_size_t) + global->device_icon_size)
#define DEVICE_ICON_DEF DEVICE_ICON_GET
#define DEVICE_ICON_GET_SET 0
#define DEVICE_ICON_GET(value) do { \
value.num_elements = \
global->device_icon_size; \
zx7_Decompress( \
value.elements, \
global->device_icon); \
} while (0)
#define DEVICE_ICON_SET(value)
/* MTP Types */
typedef struct int128 {
int64_t high;
uint64_t low;
} int128_t;
typedef struct uint128 {
uint64_t high;
uint64_t low;
} uint128_t;
typedef uint8_t mtp_byte_t;
typedef uint16_t mtp_version_t;
typedef uint16_t mtp_enum_t;
@ -141,6 +174,23 @@ typedef uint32_t mtp_size_t;
typedef uint32_t mtp_id_t;
typedef uint32_t mtp_param_t;
typedef uint64_t mtp_uint64_t;
#define DECLARE_ARRAY_TYPE(name) \
typedef struct a##name { \
mtp_size_t num_elements; \
name##_t elements[]; \
} a##name##_t;
DECLARE_ARRAY_TYPE(uint8)
DECLARE_ARRAY_TYPE(int8)
DECLARE_ARRAY_TYPE(uint16)
DECLARE_ARRAY_TYPE(int16)
DECLARE_ARRAY_TYPE(uint32)
DECLARE_ARRAY_TYPE(int32)
DECLARE_ARRAY_TYPE(uint64)
DECLARE_ARRAY_TYPE(int64)
DECLARE_ARRAY_TYPE(uint128)
DECLARE_ARRAY_TYPE(int128)
#define DECLARE_TRUNC_TYPE(name) \
typedef union mtp_trunc_##name { \
mtp_##name##_t name; \
@ -642,6 +692,13 @@ typedef enum mtp_object_property_code {
/* MTP Structures */
typedef struct mtp_device_property_description {
mtp_enum_t device_property_code;
mtp_enum_t datatype;
mtp_byte_t get_set;
mtp_byte_t values[];
} mtp_device_property_description_t;
typedef struct mtp_object_info_header {
mtp_trunc_id_t storage_id;
mtp_enum_t object_format;
@ -791,6 +848,8 @@ struct mtp_global {
mtp_transaction_t transaction;
mtp_event_t events[MTP_MAX_PENDING_EVENTS];
/* MTP Info */
size_t device_icon_size;
const void *device_icon;
size_t device_info_size;
const mtp_device_info_t *device_info;
#define DECLARE_STORAGE_INFO(name) \
@ -819,11 +878,13 @@ DECLARE_CALLBACK(get_object);
DECLARE_CALLBACK(send_object_info);
DECLARE_CALLBACK(send_object_container);
DECLARE_CALLBACK(send_object);
DECLARE_CALLBACK(zlp_data_in);
DECLARE_CALLBACK(final_data_in);
DECLARE_CALLBACK(response);
DECLARE_CALLBACK(event);
/* Other Forward Function Declarations */
usb_error_t wait_for_usb(mtp_global_t *global);
/* MTP Function Definitions */
@ -955,33 +1016,6 @@ static usb_error_t schedule_ok_response(
params, param_count, global);
}
static usb_error_t schedule_data_in_response(
usb_endpoint_t endpoint,
const void *data,
size_t data_size,
mtp_global_t *global) {
usb_error_t error;
global->transaction.container.length.size =
sizeof(mtp_container_t) +
data_size;
global->transaction.container.type =
MTP_BT_DATA;
error = usb_ScheduleBulkTransfer(
endpoint = get_endpoint(
endpoint, MTP_EP_DATA_IN),
&global->transaction,
sizeof(mtp_container_t),
NULL,
global);
if (error) return error;
return usb_ScheduleBulkTransfer(
endpoint,
(void *)data,
data_size,
final_data_in_complete,
global);
}
static usb_error_t schedule_data_in(
usb_endpoint_t endpoint,
size_t data_size,
@ -1001,6 +1035,27 @@ static usb_error_t schedule_data_in(
global);
}
static usb_error_t schedule_data_in_response(
usb_endpoint_t endpoint,
const void *data,
size_t data_size,
mtp_global_t *global) {
usb_error_t error = schedule_data_in(
endpoint, data_size, NULL, global);
if (error == USB_SUCCESS)
error = usb_ScheduleBulkTransfer(
get_endpoint(endpoint,
MTP_EP_DATA_IN),
(void *)data,
data_size,
data_size &&
!(data_size % MTP_MAX_BULK_PKT_SZ)
? zlp_data_in_complete
: final_data_in_complete,
global);
return error;
}
static usb_error_t status_error(
usb_transfer_status_t status) {
printf("transfer status = %02X\n", status);
@ -1066,11 +1121,9 @@ static void get_datetime(
boot_GetTime(&second, &minute, &hour);
sprintf(string, "%04u%02u%02uT%02u%02u%02u",
year, month, day, hour, minute, second);
do {
*(char *)result = *pointer;
++result;
++pointer;
} while (--i);
do
*(char *)result++ = *pointer++;
while (--i);
}
static int delete_object(
@ -1113,7 +1166,7 @@ static int send_object(
mtp_global_t *global) {
size += global->transaction.state
.send_object.extra;
const var_file_header_t *header = OBJECT_BUFFER;
const var_file_header_t *header = LARGE_BUFFER;
if (size <=
offsetof(var_file_header_t, entry.data) +
sizeof(uint16_t) ||
@ -1713,40 +1766,35 @@ DEFINE_CALLBACK(command) {
break;
case MTP_OPR_GET_DEVICE_PROP_DESC:
MAX_PARAMS(1);
#define DECLARE_FORM_NONE(type)
#define DECLARE_FORM_RANGE(type) \
type##_t minimum_value; \
type##_t maximum_value; \
type##_t step_size;
#define DEFINE_FORM_NONE(name)
#define DEFINE_FORM_RANGE(name) \
.minimum_value = name##_MIN, \
.maximum_value = name##_MAX, \
.step_size = name##_STEP,
#define INIT_FORM_NONE(type, name, value) (void)0
#define INIT_FORM_RANGE(type, name, value) do { \
name##_MIN((*(type##_t *)value)); \
value += name##_SIZE(type##_t); \
name##_MAX((*(type##_t *)value)); \
value += name##_SIZE(type##_t); \
name##_STEP((*(type##_t *)value)); \
value += name##_SIZE(type##_t); \
} while (0)
#define GET_DEVICE_PROP_DESC_RESPONSE(type, name, form) \
if (global->transaction.payload.params[0] == \
MTP_DP_##name) { \
static struct name##_DESC { \
mtp_enum_t device_property_code; \
mtp_enum_t datatype; \
mtp_byte_t get_set; \
type##_t factory_default_value; \
type##_t current_value; \
mtp_byte_t form_flag; \
DECLARE_FORM_##form(type) \
} name = { \
.device_property_code = MTP_DP_##name, \
.datatype = MTP_TC_##type, \
.get_set = name##_GET_SET, \
.factory_default_value = name##_DEF, \
.current_value = name##_DEF, \
.form_flag = MTP_FORM_##form, \
DEFINE_FORM_##form(name) \
}; \
name##_GET(name.current_value); \
mtp_device_property_description_t *desc = \
LARGE_BUFFER; \
desc->device_property_code = MTP_DP_##name; \
desc->datatype = MTP_TC_##type; \
desc->get_set = name##_GET_SET; \
mtp_byte_t *value = desc->values; \
name##_DEF((*(type##_t *)value)); \
value += name##_SIZE(type##_t); \
name##_GET((*(type##_t *)value)); \
value += name##_SIZE(type##_t); \
*value++ = MTP_FORM_##form; \
INIT_FORM_##form(type, name, value); \
return schedule_data_in_response( \
endpoint, &name, \
sizeof(name), global); \
endpoint, \
LARGE_BUFFER, \
value - (mtp_byte_t *)LARGE_BUFFER, \
global); \
}
FOR_EACH_SUPP_DP(GET_DEVICE_PROP_DESC_RESPONSE)
return schedule_error_response(
@ -1754,14 +1802,16 @@ DEFINE_CALLBACK(command) {
MTP_RSP_DEVICE_PROP_NOT_SUPPORTED,
global);
case MTP_OPR_GET_DEVICE_PROP_VALUE:
MAX_PARAMS(1);
#define GET_DEVICE_PROP_VALUE_RESPONSE(type, name, form) \
if (global->transaction.payload.params[0] == \
MTP_DP_##name) { \
type##_t current; \
name##_GET(current); \
name##_GET((*(type##_t *)LARGE_BUFFER)); \
return schedule_data_in_response( \
endpoint, &current, \
sizeof(current), global); \
endpoint, \
LARGE_BUFFER, \
name##_SIZE(type##_t), \
global); \
}
FOR_EACH_SUPP_DP(GET_DEVICE_PROP_VALUE_RESPONSE)
return schedule_error_response(
@ -1769,6 +1819,7 @@ DEFINE_CALLBACK(command) {
MTP_RSP_DEVICE_PROP_NOT_SUPPORTED,
global);
case MTP_OPR_SET_DEVICE_PROP_VALUE:
MAX_PARAMS(1);
usb_ScheduleBulkTransfer(
endpoint,
&global->transaction.payload,
@ -2106,7 +2157,7 @@ DEFINE_CALLBACK(send_object_container) {
.send_object.extra =
transferred -
sizeof(mtp_container_t);
memcpy(OBJECT_BUFFER,
memcpy(LARGE_BUFFER,
global->transaction.payload.buffer,
extra);
if (extra && transferred != MTP_MAX_BULK_PKT_SZ)
@ -2114,7 +2165,7 @@ DEFINE_CALLBACK(send_object_container) {
endpoint, status, extra, global);
return usb_ScheduleBulkTransfer(
endpoint,
OBJECT_BUFFER + extra,
LARGE_BUFFER + extra,
global->transaction.container.length.word -
sizeof(mtp_container_t) - extra,
send_object_complete,
@ -2144,6 +2195,18 @@ DEFINE_CALLBACK(send_object) {
endpoint, response, NULL, 0, global);
}
DEFINE_CALLBACK(zlp_data_in) {
(void)transferred;
if (status != USB_TRANSFER_COMPLETED)
return status_error(status);
if (global->reset)
return schedule_command(endpoint, global);
return usb_ScheduleBulkTransfer(
endpoint, NULL, 0,
final_data_in_complete,
global);
}
DEFINE_CALLBACK(final_data_in) {
(void)transferred;
if (status != USB_TRANSFER_COMPLETED)
@ -2263,7 +2326,7 @@ int main(void) {
static mtp_global_t global;
usb_error_t error;
ui_Init();
printf(" *** TRANSFER ***\n"
printf(" TRANSFER v0.0.2b\n"
" Connect USB to PC.\n"
" Press [clear] to exit.\n"
"--------------------------------");
@ -2434,9 +2497,13 @@ int main(void) {
};
for (mtp_byte_t i = 0; i != MTP_MAX_PENDING_EVENTS; ++i)
global.events[i].container.type = MTP_BT_EVENT;
if (info->hardwareType & 1)
if (info->hardwareType & 1) {
global.device_icon_size = ti83pce_icon_uncompressed_size;
global.device_icon = ti83pce_icon;
global.device_info_size = sizeof(mtp_device_info_t);
else {
} else {
global.device_icon_size = ti84pce_icon_uncompressed_size;
global.device_icon = ti84pce_icon;
*(mtp_byte_t *)&device.bcdDevice = 0x40; /* 2.40 */
device_info.model_length = lengthof(Lproduct84);
memcpy(device_info.model, Lproduct84, sizeof(Lproduct84));

View file

@ -6,10 +6,9 @@
private ti.DataSize
private ti.DelVarArc
private ti.EquObj
private ti.flags
private ti.GroupObj
private ti.Get_Tok_Strng
private ti.GroupObj
private ti.GroupObj
private ti.Mov9ToOP1
private ti.OP1
private ti.OP3
@ -18,13 +17,19 @@
private ti.ProgObj
private ti.ProtProgObj
private ti.PushErrorHandler
private ti.flags
private ti.tAns
private ti.tExtTok
private ti.tRecurn
private ti.tVarLst
private ti.tVarOut
include 'ti84pceg.inc'
private ImageObj
private tVarImage1
private varTypeMask
ImageObj := $1A
tVarImage1 := $50
varTypeMask := $3F
private DELETE_VAR_NOT_DELETED
@ -124,11 +129,16 @@ _get_var_data_ptr:
ex de,hl
bit 15,bc
ret nz
ld bc,9
add hl,bc
ld c,(hl)
add hl,bc
inc hl
ex de,hl
call ti.Sym_Prog_non_t_Lst
jq z,.named
ld c,2
.named:
ex de,hl
ld de,10
add hl,de
ld e,c
add hl,de
ret
section .text
@ -255,6 +265,8 @@ _get_var_file_name:
sub a,(ti.AppVarObj-ti.ProtProgObj-1) shl 1
sub a,(ti.GroupObj-ti.AppVarObj+1) shl 1
jq c,.named
sub a,(ImageObj-ti.GroupObj-1) shl 1
jq z,.image
ld a,(de)
cp a,'.'
jq z,.namedEnter
@ -331,6 +343,12 @@ _get_var_file_name:
ld a,13
sub a,c
ret
.image:
inc de
ld a,(de)
ld de,_image_name+1
add a,tVarImage1
ld (de),a
.list:
dec de
.token:
@ -344,6 +362,10 @@ _get_var_file_name:
jq .named
section .data
public _image_name
_image_name:
db ti.tExtTok,tVarImage1
public _var_extensions
_var_extensions:
db "xnxlxmxyxsxpxpci"

View file

@ -69,7 +69,7 @@ uint8_t create_var(const var_name_t *var_name,
const void *data, size_t size);
uint8_t arc_unarc_var(const var_name_t *var_name);
uint8_t get_var_file_name(const var_name_t *var_name,
wchar_t file_name[13]);
wchar_t file_name[MAX_FILE_NAME_LENGTH]);
#ifdef __cplusplus
}