Saving external sequences with my custom 128 byte patches

I know I’m kind of on my own, but maybe someone has some ideas…?

I am able to load patches (my custom 128 byte format) into the Shruthi using something like this:
static const prog_char factory_patch_5[] PROGMEM = {2,19,244,0,1,0,0,0,32,10,0,0,14,10,32,0,0,53,20,60,0,40,90,55,0,0,0,0,0,0,0,0,0,80,0,0,0,3,0,0,0,0,0,0,0,0,0,0,21,0,32,21,11,7,19,2,0,0,3,0,1,8,0,2,8,0,10,2,0,11,3,0,20,1,63,21,1,0,8,6,32,6,11,32,0,0,0,0,0,0,‘v’,‘i’,‘r’,‘g’,‘i’,‘n’,’ ‘,’ ‘,1,0,12,0,14,0,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,’!’,};
ResourcesManager::Load(factory_patch_5, 0, &patch_); Storage::WritePatch(4);

I am now trying to load sequences using something comparable like this (I didn’t change the sequence format):
static const prog_char factory_sequence_5[] PROGMEM = {0,120,0,0,0,1,0,0,16,0,0x80 | 48, 0x00 | 0x50 | 0x8, 0x80 | 48, 0x80 | 0x50 | 0x8, 0x80 | 48, 0x80 | 0x50 | 0x8, 0x80 | 48, 0x80 | 0x50 | 0x8, 0x80 | 60, 0x00 | 0x30 | 0x7, 0x80 | 60, 0x80 | 0x30 | 0x7, 0x80 | 60, 0x80 | 0x30 | 0x7, 0x80 | 60, 0x00 | 0x20 | 0x6, 0x80 | 57, 0x00 | 0x40 | 0x8, 0x80 | 57, 0x80 | 0x40 | 0x8, 0x80 | 55, 0x00 | 0x40 | 0x8, 0x80 | 55, 0x80 | 0x40 | 0x8, 0x80 | 52, 0x00 | 0x40 | 0x8, 0x80 | 52, 0x80 | 0x40 | 0x8, 0x80 | 50, 0x00 | 0x40 | 0x7, 0x80 | 50, 0x80 | 0x40 | 0x7, };
ResourcesManager::Load(factory_sequence_5, 0, &sequencer_settings_); Storage::WriteSequence(4);

This will work when loading into internal memory (the first 16 sequences), but it stops working at sequence #17 (the start of external memory), and also corrupts the patches in external memory. It seems like there is something weird about the way it’s moving from internal to external memory. Just wondering where in the code I code look for things that I might have to modify.

Things of note:
I changed two settings here to get the patches to store:
template<> class StorageConfiguration {
public:
enum {
num_internal = 11, // this was 16, 11 with 128 size, 16*92 = 1472, 11*128 = 1408
num_external = 46, // this was 64, now 46, 64*92 = 46*128 = 5888
offset_internal = 16,
offset_external = 0,
size = PATCH_SIZE,
sysex_object_id = 0x01,
undo_buffer_offset = 0,
};
};

Is there something I might have to change here:
template<> class StorageConfiguration {
public:
enum {
num_internal = 16,
num_external = 64,
offset_internal = StorageConfiguration::offset_internal + \\
StorageConfiguration::num_internal * PATCH_SIZE,
offset_external = StorageConfiguration::offset_external + \\
StorageConfiguration::num_external * PATCH_SIZE,
size = sizeof(SequenceStep) * kNumSteps,
sysex_object_id = 0x02,
undo_buffer_offset = PATCH_SIZE,
};
};

Thanks!

Semi needle in hackstack, I needed a bigger undo buffer, I think it’s fine now.

undo_buffer_[192]; // was 128, now 192