1 Star 0 Fork 10

马氏天下/010 Editor 脚本

forked from RustSBI/010 Editor 模板 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
D1Image.bt 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
//------------------------------------------------
//--- 010 Editor v13.0.1 Binary Template
//
// File: d1-flash
// Authors: Mingrui Ma
// Version: 0.0.0
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
RequiresVersion( 12 );
/**** STRUCTURES ****/
struct EgonHead;
typedef struct {
uint32 jump_instruction <format=hex, comment="address of jump_instruction">;
ubyte magic[8];
uint32 checksum <format=hex, comment="checksum">;
uint32 total_length <format=hex>;
uint32 _head_size;
uint32 fel_script_address;
uint32 fel_uenv_length;
uint32 dt_name_offset;
uint32 dram_size;
uint32 boot_media;
uint32 string_pool[13];
} EgonHead;
/**** PARSING CODE ****/
LittleEndian();
EgonHead head <bgcolor=cLtPurple>;
local uint32 opcode = head.jump_instruction & 0x7f;
// 0x6f JAL opcode
if (opcode == 0x6f)
{
local uint32 imm1912 = (head.jump_instruction >> 12) & 0xff;
local uint32 imm11 = (head.jump_instruction >> 20) & 0x01;
local uint32 imm101 = (head.jump_instruction >> 21) & 0x3ff;
local uint32 imm20 = (head.jump_instruction >> 31) & 0x01;
local uint32 offset = (imm20 << 20) + (imm1912 << 12) + (imm11 << 11) + (imm101 << 1);
local quad off = FTell();
if(offset < FileSize() && head.total_length <= FileSize()) {
FSeek(offset);
ubyte code[head.total_length - offset] <comment="code",bgcolor=cLtGreen>;
} else {
Warning("code appears to either overlap with header, exist after the end of the file or overlap with the end of the file!");
}
FSeek(off);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mashitianxia/010-editor-scripts.git
git@gitee.com:mashitianxia/010-editor-scripts.git
mashitianxia
010-editor-scripts
010 Editor 脚本
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385