zig-protobuf icon indicating copy to clipboard operation
zig-protobuf copied to clipboard

Can't generate proto files without package name

Open osztenkurden opened this issue 6 months ago • 3 comments

Overall, love the generator, and the only thing that stumbled me was the fact that I can't generate zig files from protos without "package" directive.

Currently working on game data parser, and protos look like this:

import "networkbasetypes.proto";
import "usercmd.proto";

message CSGOInterpolationInfoPB {
	optional int32 src_tick = 1 [default = -1];
	optional int32 dst_tick = 2 [default = -1];
	optional float frac = 3 [default = 0];
}

message CSGOInputHistoryEntryPB {
	optional .CMsgQAngle view_angles = 2;
	optional int32 render_tick_count = 4;
	optional float render_tick_fraction = 5;
	optional int32 player_tick_count = 6;
	optional float player_tick_fraction = 7;
	optional .CSGOInterpolationInfoPB cl_interp = 12;
	optional .CSGOInterpolationInfoPB sv_interp0 = 13;
	optional .CSGOInterpolationInfoPB sv_interp1 = 14;
	optional .CSGOInterpolationInfoPB player_interp = 15;
	optional int32 frame_number = 20;
	optional int32 target_ent_index = 8 [default = -1];
	optional .CMsgVector shoot_position = 3;
	optional .CMsgVector target_head_pos_check = 9;
	optional .CMsgVector target_abs_pos_check = 10;
	optional .CMsgQAngle target_abs_ang_check = 11;
}

...

So, no package name. To make it work, Im adding package name by hand, and then I have to also remove dots from the field types on messages (so optional .CSGOInterpolationInfoPB cl_interp = 12; will become optional CSGOInterpolationInfoPB cl_interp = 12;). I'm trying currently to make it work on the fork of the project, but I'm quite new to zig, so it's not going super fast

osztenkurden avatar Aug 02 '24 10:08 osztenkurden